Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sixarm_ruby_active_record_mock

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sixarm_ruby_active_record_mock

  • 1.4.6
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= SixArm.com » Ruby » ActiveRecord mock object for testing Rails

Author:: Joel Parker Henderson, joel@joelparkerhenderson.com Copyright:: Copyright (c) 2006-2011 Joel Parker Henderson License:: See LICENSE.txt file

A simple mock object that provides the ActiveRecord method signatures read_attribute(key) and write_attribute(key,val), and simple record finder signatures find(id) and find(:all).

This provides some of the ActiveRecord method signatures we use:

  • read_attribute(key)
  • write_attribute(key,val)
  • find(id)
  • find(:all)

Example: mock = ActiveRecordMock.new mock.write_attribute('foo','bar') mock.read_attribute('foo') => 'bar'

Example of initialize with attributes: mock = ActiveRecordMock.new(:foo => 'bar', :goo => 'car', :hoo => 'dar') mock.read_attribute(:foo') => 'bar' mock.read_attribute(:goo') => 'car' mock.read_attribute(:hoo') => 'dar'

Example of creating mock users: anne = ActiveRecordMock.new(:id => 123, :name => 'Anne') beth = ActiveRecordMock.new(:id => 456, :name => 'Beth') cate = ActiveRecordMock.new(:id => 789, :name => 'Cate')

Example of mock finder creation: ActiveRecordMock.find=[anne,beth,cate]

Example of mock finder retrieval of records by id: ActiveRecordMock.find(123) => anne ActiveRecordMock.find(456) => beth ActiveRecordMock.find(789) => cate

Example of mock finder retrieval of all records: ActiveRecordMock.find(:all) => [anne,beth,cate]

FAQs

Package last updated on 02 May 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc