Skip to content

Run tests with rails 6 (fix test failures) #966

@pravi

Description

@pravi

After making rails 6 the default rails version,

diff --git a/Gemfile b/Gemfile
index 06b1701..68863be 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,10 +5,13 @@ gemspec
 if ENV["RAILS_VERSION"] && (ENV["RAILS_VERSION"].to_i == 4)
   gem "rails", "< 5"
   gem "rspec-rails", "> 3"
+elsif ENV["RAILS_VERSION"] && (ENV["RAILS_VERSION"].to_i == 5)
+  gem "rails", "< 6"
+  gem "rspec-rails", "> 3"
 elsif ENV["RAILS_VERSION"] && (ENV["RAILS_VERSION"].to_i == 0)
   # no-op. No Rails.
 else
-  gem "rails", "< 6"
+  gem "rails", "< 7"
   gem "rspec-rails", "> 3"
 end

some tests are failing

$ bundle update rails
$ bundle exec rails
Failures:

  1) Rails Integration doesn't do anything on a normal route
     Failure/Error: expect(response.status).to eq(200)
     
       expected: 200
            got: 403
     
       (compared using ==)
     # ./spec/raven/integrations/rails_spec.rb:19:in `block (2 levels) in <top (required)>'

  2) Rails Integration should capture exceptions in production
     Failure/Error: expect(response.status).to eq(500)
     
       expected: 500
            got: 403
     
       (compared using ==)
     # ./spec/raven/integrations/rails_spec.rb:26:in `block (2 levels) in <top (required)>'

  3) Rails Integration should properly set the exception's URL
     Failure/Error: event = JSON.parse!(Raven.client.transport.events.first[1])
     
     NoMethodError:
       undefined method `[]' for nil:NilClass
     # ./spec/raven/integrations/rails_spec.rb:35:in `block (2 levels) in <top (required)>'

  4) Rails Integration sets transaction to ControllerName#method
     Failure/Error: event = JSON.parse!(Raven.client.transport.events.first[1])
     
     NoMethodError:
       undefined method `[]' for nil:NilClass
     # ./spec/raven/integrations/rails_spec.rb:42:in `block (2 levels) in <top (required)>'

We'd like to switch to rails 6 for next release of debian and it'd be nice if these tests can be fixed.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions