Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test against Rails 5 #229

Merged
merged 1 commit into from
Mar 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ rails_versions.each do |rails_version|
gem 'rails', rails_version
end
end

appraise "rails50" do
gem "rails", "~> 5.0.0.beta3"
gem "rspec-rails", "3.5.0.beta1"
gem "rails-controller-testing"
end
7 changes: 4 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
source "http://rubygems.org"

gem 'appraisal'
source "https://rubygems.org"

gemspec

gem "appraisal"
gem "rspec-rails", "~> 3.2"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go as development dependencies in the gemspec?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go as development dependencies in the gemspec?

No, because they differ with appraisals. 👍

76 changes: 38 additions & 38 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ PATH
high_voltage (2.4.0)

GEM
remote: http://rubygems.org/
remote: https://rubygems.org/
specs:
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
actionpack (4.2.5.2)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should Gemfile.lock be ignored?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, what's the reasoning behind ignoring the lock file? I haven't seen it ignored in any of our other open source libraries like Clearance or shoulda-matchers.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have tests and development environment install all the latest allowed versions for the dependencies, to make sure they are properly declared. Is there a reason why we'd prefer to keep it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In clearance I've kept Gemfile.lock checked in. It represents a known state that should work for anyone cloning the project.

The gemfile.lock files created by appraisal are not checked in, so CI runs against latest allowed (and I can run against latest allowed with appraisal rake).

actionview (= 4.2.5.2)
activesupport (= 4.2.5.2)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.5.2)
activesupport (= 4.2.5.2)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activesupport (4.2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activesupport (4.2.5.2)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
Expand All @@ -34,55 +34,55 @@ GEM
diff-lcs (1.2.5)
erubis (2.7.0)
i18n (0.7.0)
json (1.8.2)
loofah (2.0.1)
json (1.8.3)
loofah (2.0.3)
nokogiri (>= 1.5.9)
method_source (0.8.2)
mini_portile (0.6.2)
minitest (5.5.1)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
mini_portile2 (2.0.0)
minitest (5.8.4)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.6.0)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.5)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
railties (4.2.5.2)
actionpack (= 4.2.5.2)
activesupport (= 4.2.5.2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rspec-core (3.2.1)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.0)
rake (10.5.0)
rspec-core (3.4.3)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-rails (3.2.1)
rspec-support (~> 3.4.0)
rspec-rails (3.4.2)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
slop (3.6.0)
thor (0.19.1)
thread_safe (0.3.4)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)

Expand All @@ -94,7 +94,7 @@ DEPENDENCIES
appraisal
high_voltage!
pry
rspec-rails (~> 3.2.0)
rspec-rails (~> 3.2)

BUNDLED WITH
1.10.0
1.11.2
3 changes: 2 additions & 1 deletion gemfiles/rails4.0.gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This file was generated by Appraisal

source "http://rubygems.org"
source "https://rubygems.org"

gem "appraisal"
gem "rspec-rails", "~> 3.2"
gem "rails", "~> 4.0.0"

gemspec :path => "../"
3 changes: 2 additions & 1 deletion gemfiles/rails4.1.gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This file was generated by Appraisal

source "http://rubygems.org"
source "https://rubygems.org"

gem "appraisal"
gem "rspec-rails", "~> 3.2"
gem "rails", "~> 4.1.0"

gemspec :path => "../"
3 changes: 2 additions & 1 deletion gemfiles/rails4.2.gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This file was generated by Appraisal

source "http://rubygems.org"
source "https://rubygems.org"

gem "appraisal"
gem "rspec-rails", "~> 3.2"
gem "rails", "~> 4.2.0"

gemspec :path => "../"
10 changes: 10 additions & 0 deletions gemfiles/rails50.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "appraisal"
gem "rspec-rails", "3.5.0.beta1"
gem "rails", "~> 5.0.0.beta3"
gem "rails-controller-testing"

gemspec :path => "../"
1 change: 0 additions & 1 deletion high_voltage.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ Gem::Specification.new do |s|

s.add_development_dependency("activesupport", ">= 3.1.0")
s.add_development_dependency("pry")
s.add_development_dependency("rspec-rails", "~> 3.2.0")
end
9 changes: 9 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,13 @@
config.include RSpec::Matchers
config.mock_with :rspec
config.order = "random"

if Rails::VERSION::MAJOR >= 5
require "rails-controller-testing"

config.include(
Rails::Controller::Testing::TemplateAssertions,
type: :controller,
)
end
end
15 changes: 15 additions & 0 deletions spec/support/http_method_shim.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Rails 5 deprecates calling HTTP action methods with positional arguments
# in favor of keyword arguments. However, the keyword argument form is only
# supported in Rails 5+. Since we support back to 4, we need some sort of shim
# to avoid super noisy deprecations when running tests.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Will get this into doorkeeper. Thank you! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't take credit, got this from @derekprior and Clearance.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, thank you Derek, too! 👍

module HTTPMethodShim
def get(path, params = nil, headers = nil)
super(path, params: params, headers: headers)
end
end

if Rails::VERSION::MAJOR >= 5
RSpec.configure do |config|
config.include HTTPMethodShim, type: :controller
end
end