RSpec Code Examples

 

 

FixtureReplacement::AttributeBuilder
should add the instance to the global attributes
should have no instances when none have been created
should have two instances when two have been created
should have the fixture name as accessible
should have the from attribute as nil, if none provided
should have the from attribute as the symbol of the attribute from which it derives
should be able to find the Attribute by fixture name
should find no attributes for fixture_name :baz, if it was never created
should find no attributes for fixture_name :baz, if no fixture at all was ever created
should have the class name if specified
should use the class name of the fixture_name, camel-cased, if the class is unspecified, and the fixture uninherited
should use the class name of the inherited attribute, if specified
should prefer the constantized name to the derived name
should use the derived name if the constantized name fails (doesn't exist)
should raise a name error if it has no class, the name can't be constantized, and is derived, but the derived class can't be constantized
should not raise an error if the model ends with 's'
should allow a string key
should allow a string name for the builder
should store the from key as a symbol, even when passed a string
should convert the fixture name to a symbol
FixtureReplacement::AttributeBuilder validating all instances
should return true if there are no instances
should raise an error if an instance is not valid
should not raise an error if there is only one instance, and it is valid
should raise an error, giving the fixture name, and the error
should use the correct name
should use the correct errors
should use multiple errors on a single model
FixtureReplacement random_string
should not be the same as another randomly generated string
should by default be 10 characters long
should be able to specify the length of the random string
should only generate lowercase letters
FixtureReplacement requiring the fixtures file
should require db/example_data
should use the correct rails root
should not blow up if the file is not found
FixtureReplacement rails_root
should be the RAILS_ROOT constant if given
should use the correct RAILS_ROOT
should be '.' if not defined
FixtureReplacement reload!
should call load on the main fixture replacement file
FixtureReplacement method_added
should be private
FixtureReplacement
should alias FixtureReplacement
create_user with attr_protected attributes
should not complain when an apparent mass assignment has happened with default values
should not be a new record
should have admin_status equal to the default value (when it has not been overwritten)
should have admin_status equal to the overwritten value
should have the other attributes assigned when the attr_value has been overwritten
should have the other attributes assigned even when the attr_value has not been overwritten
new_user with attr_protected attributes
should return a new Admin with new_admin
should have admin_status equal to the default value (when it has not been overwritten)
should have admin_status equal to the overwritten value
should have the other attributes assigned when the attr_value has been overwritten
should have the other attributes assigned even when the attr_value has not been overwritten
keys passed to attributes for
should raise an invalid key error when an invalid key is passed
the create_* method
should be a user for attributes_for :user
should use the given class
should find the correct class name
should over-write the User's hash with any hash given to create_user
should add any hash key-value pairs which weren't previously given in user_attributes
should not be saved to the database
cyclic dependencies
should allow them
should associate an event with a schedule
should associate a schedule with an event
should back associate
default_* warnings
should warn when using default_
should use the correct builder name
should return a new instance
extending an object
should not create the create_* method in every instance of the class
including an object
should include methods into instances of the class
HasAndBelongsToMany Associations
should have the fixture create_subscriber
should have the fixture create_subscription
should be able to create a new subscriber
should have the subscriber with the default subscription
should be able to create a subscriber with two subscriptions (inline)
should be able to create a subscriber with two subscriptions, from the fixtures
the new_* method
should be a user for attributes_for :user
should use the given class
should find the correct class name
should return a new object with the keys given in user_attributes
should over-write the User's hash with any hash given to new_user
should add any hash key-value pairs which weren't previously given in user_attributes
should not be saved to the database
should be able to be saved to the database
should yield the object inside the block
With a public, user defined method
should be able to call it
With a private, user defined method
should be able to call it
including methods
should have the create_user method as public
should respond_to? create_user
valid_*_attributes
should generate the method valid_user_attributes when attributes_for is specified
should generate the method valid_member_attributes when attributes_for is specified
should have the attributes given as a hash
should have the attributes given
validations
should not raise with a record that has no validations
should raise an error when the record is not valid
should not raise if the record is valid
should not raise if first loaded with an invalid record, and later a valid one after reloading
random_string
should have a different string for each instance in the base class
should have a different string for each instance in the inherited class (with STI)
FixtureReplacement
should be at version 3.0.1