- FixtureReplacement
- should have the method attributes_for
- FixtureReplacement attributes_for
- should take a fixture name
- should take a fixture name along with a hash of attributes
- should create a new FixtureAttribute with the name given
- should create a new FixtureAttribute with the name given and class given
- should create a new FixtureAttribute with the name given and the attributes from
- should create a new FixtureAttribute with the name and block given
- FixtureReplacement.attributes_for
- should yield an OpenStruct
- should not raise an error if no block is given
- should create a new Attribute with the class, attributes_from, and the attributes as a lambda
- FixtureReplacementController::AttributeCollection
- 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'
- FixtureReplacementController::AttributeCollection hash, with simple arguments (only attributes and fixture name)
- should return a hash
- should return the attributes hash given
- FixtureReplacementController::AttributeCollection with an empty hash, after merge with another inherited attribute
- should contain the keys from the inherited hash only
- FixtureReplacementController::AttributeCollection 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
- 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
- FixtureReplacementController::MethodGenerator default_user
- should return a DelayedEvaluationProc
- should return the special proc, which in turn should return an array
of the name of the model ('user') if no params were given
- should return the special proc, which in turn should return an array
of the name of the model ('user') and the params given
- should generate the method default_user in the module
- FixtureReplacementController::MethodGenerator default_admin
- should return a DelayedEvaluationProc
- should return the special proc, which in turn should return an array
of the name of the model ('user') if no params were given
- should return the special proc, which in turn should return an array
of the name of the model ('user') and the params given
- should generate the method default_user in the module
- FixtureReplacementController::MethodGenerator Evaluation loading
- should not raise an error if the a default_* method is referenced before it is defined
- should merge the hash with item and writing when new_writing is called
- should merge the has with item and writing when create_writing is called
- MethodGenerator.generate_methods
- should find each of the attributes
- should create a new MethodGenerator for each attribute
- should generate the methods for each new MethodGenerator created
- FixtureReplacementController::MethodGenerator generate_methods (the instance method)
- should generate the default method
- should generate the new method
- should generate the create method
- FixtureReplacementController::MethodGenerator generate_create_method for User when user_attributes is defined (and valid)
- should generate the method new_user
- should generate the method create_fixture_name in the module
- should generate the method create_fixture_name which can take an optional hash
(it actually takes any number of params, but only uses the first hash given)
- should save the user with save!
- should return a kind of the fixture name
- should return a type (User, Admin,...) which has been saved
- should user the default hash parameters, if none are given
- should be able to overwrite the hash with the parameters given
- FixtureReplacementController::MethodGenerator generate_create_method for Admin
- should generate the method new_user
- should generate the method create_fixture_name in the module
- should generate the method create_fixture_name which can take an optional hash
(it actually takes any number of params, but only uses the first hash given)
- should save the user with save!
- should return a kind of the fixture name
- should return a type (User, Admin,...) which has been saved
- should user the default hash parameters, if none are given
- should be able to overwrite the hash with the parameters given
- FixtureReplacementController::MethodGenerator generate_create_method for User when user_attributes is defined, but not valid
- should generate the method new_user
- should generate the method create_fixture_name in the module
- should generate the method create_fixture_name which can take an optional hash
(it actually takes any number of params, but only uses the first hash given)
- should not create the record after executing create_user when the user's attributes are invalid
(it should raise an ActiveRecord::RecordInvalid error)
- FixtureReplacementController::MethodGenerator generate_new_method for User
- should respond to new_user in the module
- should return a new User object
- should return a new User 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
- FixtureReplacementController::MethodGenerator generate_new_method for Admin
- should respond to new_user in the module
- should return a new User object
- should return a new User 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
- FixtureReplacementController::MethodGenerator generate_new_method with associations
- should evaluate any of the default_* methods before returning (if no over-writing key is given)
- should evaluate any of the default_* methods before returning, with the hash params given to default_* method
- should call Gender.save! when the default_gender method is evaluated by default_gender
- should not call Gender.save! if the default_gender is overwritten by another value
- should be able to overwrite a default_* method
- FixtureReplacementController::MethodGenerator
- should have the class method generate_methods
- should be able to respond to generate_default_method
- should respond to generate_create_method
- should respond to generate_new_method
- DelayedEvaluationProc
- should be a kind of proc
- OpenStruct to_hash
- should return the hash it works with
- String.random
- 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.defaults_file
- should be RAILS_ROOT/db/example_data.rb by default
- should be foo.rb if set
- FixtureReplacement
- should generate the methods when included
- should not generate the methods before being included
- FixtureReplacement including the module
- should raise an error if RAILS_ENV is production
- should raise an error if RAILS_ENV is in staging, and the excluded_environments includes staging
- should have the method environment_is_in_excluded_environments? as private
- FixtureReplacement
- should by default have the excluded environments as just the production environment
- should be able to set the excluded environments
- 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
- FixtureReplacementController::AttributeCollection Send Regresssion
- should be able to send the message (to_new_class_instance), even if the send method has been redefined
- FixtureReplacementController::AttributeCollection send regression, part 2
- should be able to send the message with __send__
- FixtureReplacementController::AttributeCollection
- should evaluate the proc in the binding of the caller which is passed
- should get the correct value for the method called
- String.random
- 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 raise the error: 'Error in FixtureReplacement plugin: ...
- should raise the error if the error is not a LoadError