Commit f29f96b2 by Jon Yurek

Running Rails 4 specs and features

parent 3b40121b
......@@ -12,3 +12,8 @@ appraise "3.2" do
gem "rails", "~> 3.2.6"
gem "paperclip", :path => "../"
end
appraise "4.0" do
gem "rails", "~> 4.0.0"
gem "paperclip", :path => "../"
end
source "https://rubygems.org"
gemspec
gem "jruby-openssl", :platform => :jruby
gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
gem "sqlite3", :platform => :ruby
......@@ -7,6 +7,7 @@ Feature: Rails integration
And I run a migration
And I update my new user view to include the file upload field
And I update my user view to include the attachment
And I allow the attachment to be submitted
Scenario: Configure defaults for all attachments through Railtie
Given I add this snippet to config/application.rb:
......
......@@ -16,6 +16,7 @@ Given /^I generate a new rails application$/ do
gem "aws-sdk"
"""
And I remove turbolinks if it exists
And I empty the application.js file if it exists
And I configure the application to use "paperclip" from this project
And I reset Bundler environment variable
And I successfully run `bundle install --local`
......@@ -30,16 +31,16 @@ Given "I fix the application.rb for 3.0.12" do
end
end
def transform_file(filename)
content = File.read(filename)
File.open(filename, "w") do |f|
content = yield(content)
f.write(content)
Given "I allow the attachment to be submitted" do
in_current_dir 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 if it exists" do
if framework_major_version >= 4
in_current_dir do
transform_file("app/assets/javascripts/application.js") do |content|
content.gsub("//= require turbolinks", "")
......@@ -48,6 +49,13 @@ Given "I remove turbolinks if it exists" do
content.gsub(', "data-turbolinks-track" => true', "")
end
end
end
Given "I empty the application.js file if it exists" do
in_current_dir do
transform_file("app/assets/javascripts/application.js") do |content|
""
end
end
end
......@@ -167,3 +175,13 @@ Given /^I am using Rails newer than ([\d\.]+)$/ do |version|
pending "Not supported in Rails < #{version}"
end
end
def transform_file(filename)
if File.exists?(filename)
content = File.read(filename)
File.open(filename, "w") do |f|
content = yield(content)
f.write(content)
end
end
end
# This file was generated by Appraisal
source "https://rubygems.org"
gem "jruby-openssl", :platform=>:jruby
gem "activerecord-jdbcsqlite3-adapter", :platform=>:jruby
gem "sqlite3", :platform=>:ruby
gem "rails", "~> 4.0.0"
gem "paperclip", :path=>"../"
gemspec :path=>"../"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment