2010-11-10 15:59:38 -05:00
|
|
|
When /^I add "([^"]+)" from this project as a dependency$/ do |gem_name|
|
2011-09-08 10:30:26 -06:00
|
|
|
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})
|
2010-06-09 11:42:48 -04:00
|
|
|
end
|
2012-11-29 02:46:29 -08:00
|
|
|
|
|
|
|
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
|
2012-12-07 11:48:05 -05:00
|
|
|
|
|
|
|
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
|
2012-12-10 11:29:57 -05:00
|
|
|
|
|
|
|
When /^I configure the testing framework to use MiniTest$/ do
|
|
|
|
append_to_file('Gemfile', %{gem "minitest-rails", :group => [:development, :test]\n})
|
2012-12-21 11:08:37 -05:00
|
|
|
step %{I run `rails generate mini_test:install` with a clean environment}
|
2012-12-10 11:29:57 -05:00
|
|
|
|
|
|
|
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
|
2012-12-13 16:41:16 -05:00
|
|
|
|
2012-12-19 15:04:29 -05:00
|
|
|
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
|