Sha256: b20f5574859b5d9f299766c3116ef68f29b8418f8688c64c8d90acc3759796cf

Contents?: true

Size: 1.7 KB

Versions: 4

Compression:

Stored size: 1.7 KB

Contents

When /^I add "([^"]+)" from this project as a dependency$/ do |gem_name|
  append_to_file('Gemfile', %{gem "#{gem_name}", :path => "#{PROJECT_ROOT}"\n})
end

When /^I add "([^"]+)" as a dependency$/ do |gem_name|
  append_to_file('Gemfile', %{gem "#{gem_name}"\n})
end

When /^I set the FactoryGirl :suffix option to "([^"]+)"$/ do |suffix|
  append_to_file('config/application.rb', <<-RUBY)
    module Testapp
      class Application < Rails::Application
        config.generators do |g|
          g.fixture_replacement :factory_girl, :suffix => '#{suffix}'
        end
      end
    end
  RUBY

end

When /^I configure the factories as:$/ do |string|
  append_to_file File.join('config', 'application.rb'), <<-END
class Testapp::Application
  #{string}
end
  END
end

When /^I configure the factories directory as "([^"]+)"$/ do |factory_dir|
  append_to_file File.join('config', 'application.rb'), <<-END
class Testapp::Application
  config.generators do |g|
    g.fixture_replacement :factory_girl, :dir => "#{factory_dir}"
  end
end
  END
end

When /^I configure the testing framework to use MiniTest$/ do
  append_to_file('Gemfile', %{gem "minitest-rails", :group => [:development, :test]\n})
  step %{I run `rails generate mini_test:install` with a clean environment}

  append_to_file File.join('config', 'application.rb'), <<-END
class Testapp::Application
  config.generators do |g|
    g.test_framework :mini_test, :fixture => false, :fixture_replacement => :factory_girl
  end
end
  END
end

When /^I comment out gem "([^"]*)" from my Gemfile$/ do |gem_name|
  in_current_dir do
    content = File.read('Gemfile')
    File.open('Gemfile', 'w') do |f|
      f.write content.sub(/gem ['"]#{gem_name}/, '#\1')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
factory_girl_rails-4.4.1 features/step_definitions/rails_steps.rb
factory_girl_rails-4.4.0 features/step_definitions/rails_steps.rb
factory_girl_rails-4.3.0 features/step_definitions/rails_steps.rb
factory_girl_rails-4.2.1 features/step_definitions/rails_steps.rb