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 not raise an error if the model ends with 's'
FixtureReplacement::AttributeBuilder hash, with simple arguments (only attributes and fixture name)
should return a hash
should return the attributes hash given
FixtureReplacement::AttributeBuilder with an empty hash, after merge with another inherited attribute
should contain the keys from the inherited hash only
FixtureReplacement::AttributeBuilder with a hash, after merge with another inherited attributes
should overwrite an attribute
should keep any new attributes, as well as any attributes which weren't overwritten
FixtureReplacement
should have create as the default
should be able to set dependent object creation
should have the default_method as :create when create_dependent_objects?
should have the default_method as :new when create_dependent_objects == false
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
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
the create_* method
should be a user for attributes_for :user
should use the given class
should evaluate any of the default_* methods before returning (if no over-writing key is given)
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
default build method
should use create when not specified
should not create the objects if create_dependent_objects = false
default_method
should create a proc
should instantiate a new instance of the class when calling the proc generated
should create the object
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 evaluate any of the default_* methods before returning (if no over-writing key is given)
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 have saved dependent objects with the default_* method
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
should evaluate a default_* call
FixtureReplacement::MethodGenerator Evaluation loading
should not raise an error if the a default_* method is referenced before it is defined
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 2.0.1