features/step_definitions/rails_steps.rb in paperclip-4.3.0 vs features/step_definitions/rails_steps.rb in paperclip-4.3.1

- old
+ new

@@ -22,28 +22,28 @@ And I configure the application to use "paperclip" from this project } end Given "I fix the application.rb for 3.0.12" do - in_current_dir do + cd(".") do File.open("config/application.rb", "a") do |f| f << "ActionController::Base.config.relative_url_root = ''" end end end Given "I allow the attachment to be submitted" do - in_current_dir do + cd(".") do transform_file("app/controllers/users_controller.rb") do |content| content.gsub("params.require(:user).permit(:name)", "params.require(:user).permit!") end end end Given "I remove turbolinks" do - in_current_dir do + cd(".") do transform_file("app/assets/javascripts/application.js") do |content| content.gsub("//= require turbolinks", "") end transform_file("app/views/layouts/application.html.erb") do |content| content.gsub(', "data-turbolinks-track" => true', "") @@ -68,19 +68,19 @@ if definition snippet += ", \n" snippet += definition end snippet += "\ndo_not_validate_attachment_file_type :#{name}\n" - in_current_dir do + cd(".") do transform_file("app/models/user.rb") do |content| content.sub(/end\Z/, "#{snippet}\nend") end end end Given "I empty the application.js file" do - in_current_dir do + cd(".") do transform_file("app/assets/javascripts/application.js") do |content| "" end end end @@ -126,37 +126,37 @@ } end Given /^I add this snippet to the User model:$/ do |snippet| file_name = "app/models/user.rb" - in_current_dir do + cd(".") do 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 + cd(".") 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 + cd(".") do require "./config/environment" require "capybara/rails" end end Given /^I reload my application$/ do Rails::Application.reload! end When /^I turn off class caching$/ do - in_current_dir do + cd(".") do file = "config/environments/test.rb" config = IO.read(file) config.gsub!(%r{^\s*config.cache_classes.*$}, "config.cache_classes = false") File.open(file, "w"){|f| f.write(config) } @@ -164,11 +164,11 @@ end Then /^the file at "([^"]*)" should be the same as "([^"]*)"$/ do |web_file, path| expected = IO.read(path) actual = read_from_web(web_file) - actual.should == expected + expect(actual).to eq(expected) end When /^I configure the application to use "([^\"]+)" from this project$/ do |name| append_to_gemfile "gem '#{name}', :path => '#{PROJECT_ROOT}'" steps %{And I run `bundle install --local`} @@ -196,10 +196,10 @@ end end Given(/^I add a "(.*?)" processor in "(.*?)"$/) do |processor, directory| filename = "#{directory}/#{processor}.rb" - in_current_dir do + cd(".") do FileUtils.mkdir_p directory File.open(filename, "w") do |f| f.write(<<-CLASS) module Paperclip class #{processor.capitalize} < Processor