features/step_definitions/rails_steps.rb in paperclip-3.0.4 vs features/step_definitions/rails_steps.rb in paperclip-3.1.0
- old
+ new
@@ -27,13 +27,17 @@
Given /^I run a paperclip generator to add a paperclip "([^"]*)" to the "([^"]*)" model$/ do |attachment_name, model_name|
step %[I successfully run `bundle exec #{generator_command} paperclip #{model_name} #{attachment_name}`]
end
Given /^I run a migration$/ do
- step %[I successfully run `bundle exec rake db:migrate`]
+ step %[I successfully run `bundle exec rake db:migrate --trace`]
end
+When /^I rollback a migration$/ do
+ step %[I successfully run `bundle exec rake db:rollback STEPS=1 --trace`]
+end
+
Given /^I update my new user view to include the file upload field$/ do
steps %{
Given I overwrite "app/views/users/new.html.erb" with:
"""
<%= form_for @user, :html => { :multipart => true } do |f| %>
@@ -63,10 +67,18 @@
content = File.read(file_name)
File.open(file_name, 'w') { |f| f << content.sub(/end\Z/, "#{snippet}\nend") }
end
end
+Given /^I add this snippet to config\/application.rb:$/ do |snippet|
+ file_name = "config/application.rb"
+ in_current_dir do
+ content = File.read(file_name)
+ File.open(file_name, 'w') {|f| f << content.sub(/class Application < Rails::Application.*$/, "class Application < Rails::Application\n#{snippet}\n")}
+ end
+end
+
Given /^I start the rails application$/ do
in_current_dir do
require "./config/environment"
require "capybara/rails"
end
@@ -115,6 +127,12 @@
end
end
When /^I comment out the gem "([^"]*)" from the Gemfile$/ do |gemname|
comment_out_gem_in_gemfile gemname
+end
+
+Given /^I am using Rails newer than ([\d\.]+)$/ do |version|
+ if framework_version < version
+ pending "Not supported in Rails < #{version}"
+ end
end