1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot_rails.git synced 2022-11-09 11:49:18 -05:00
thoughtbot--factory_bot_rails/features/step_definitions/rails_steps.rb
Dan Croak 00cb2eabb1 Test against Rails 3.2, 4.0, 4.1
* Remove gemfiles from version control to match same testing style as
  Clearance and Suspenders.
* MiniTest does not need to be manually included as it is automatically
  included by Rails by default.
* Add spring for Rails 4.1.
* Disable Spring to get specs to pass on Rails 4.1.
* Add therubyrhino for JRuby.
* Remove old references to Rails 3.
* Fix JRuby test where output is "1 runs", not "1 tests".
* Remove Rails 3.0 reference to "turn".
2014-05-27 00:41:24 -07:00

55 lines
1.4 KiB
Ruby

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 print out "([^"]*)"$/ do |path|
in_current_dir do
File.open(path, 'r') do |f|
puts f.inspect
end
end
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 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