Sha256: 2df2c79ce36b3df740873ca4f74773eff65e3bd8d0ad32b1e4dc574ba2a182cb

Contents?: true

Size: 1.94 KB

Versions: 5

Compression:

Stored size: 1.94 KB

Contents

Feature:
  In order to easily generate factory files instead of fixture files when generating models
  As a user of Rails3 and factory_girl
  I would like to use factory_girl_rails generators.

  Background:
    Given I successfully run `bundle exec rails new testapp`
    And I cd to "testapp"
    And I add "factory_girl_rails" from this project as a dependency

  Scenario: The factory_girl_rails generators create a factory file for each model that I generate
    When I run `bundle install` with a clean environment
    And I run `bundle exec rails generate model User name:string --fixture-replacement=factory_girl` with a clean environment
    And I run `bundle exec rails generate model Namespaced::User name:string --fixture-replacement=factory_girl` with a clean environment
    Then the output should contain "test/factories/users.rb"
    And the output should contain "test/factories/namespaced_users.rb"
    And the file "test/factories/users.rb" should contain "factory :user do"
    And the file "test/factories/namespaced_users.rb" should contain "factory :namespaced_user, :class => 'Namespaced::User' do"

  Scenario: The factory_girl_rails generators create a factory file with a custom name for each model that I generate
    When I run `bundle install` with a clean environment
    And I set the FactoryGirl :suffix option to "factory"
    And I run `bundle exec rails generate model User name:string --fixture-replacement=factory_girl` with a clean environment
    And I run `bundle exec rails generate model Namespaced::User name:string --fixture-replacement=factory_girl` with a clean environment
    Then the output should contain "test/factories/users_factory.rb"
    And the output should contain "test/factories/namespaced_users_factory.rb"
    And the file "test/factories/users_factory.rb" should contain "factory :user do"
    And the file "test/factories/namespaced_users_factory.rb" should contain "factory :namespaced_user, :class => 'Namespaced::User' do"

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
factory_girl_rails-4.4.1 features/generators.feature
factory_girl_rails-4.4.0 features/generators.feature
factory_girl_rails-4.3.0 features/generators.feature
factory_girl_rails-4.2.1 features/generators.feature
factory_girl_rails-4.2.0 features/generators.feature