-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add back Ruby 2.2 support for Rails 5 #2332
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
require 'support/group_failure_formatter' | ||
|
||
module RSpec::Rails | ||
RSpec.describe ViewExampleGroup do | ||
it_behaves_like "an rspec-rails example group mixin", :view, | ||
|
@@ -234,17 +236,29 @@ def _view; end # Stub method | |
expect(view_spec.view).to eq(view) | ||
end | ||
|
||
it 'is accessible to hooks' do | ||
if RUBY_VERSION <= "2.3.0" && ENV["RAILS_VERSION"] !~ /stable/ && ::Rails.version.to_f == 5.2 | ||
pending_only_on_ruby_22_rails_52 = """ | ||
Rails 5.2.4.2 has a syntax error in ActionDispatch::Request::Session. | ||
(A &. usage which does not work in 2.2.10) | ||
It has been fixed but not released, this spec will not pass until that | ||
has been released. | ||
""" | ||
else | ||
pending_only_on_ruby_22_rails_52 = false | ||
end | ||
|
||
it 'is accessible to hooks', pending: pending_only_on_ruby_22_rails_52 do | ||
with_isolated_config do | ||
run_count = 0 | ||
RSpec.configuration.before(:each, type: :view) do | ||
allow(view).to receive(:render) { :value } | ||
run_count += 1 | ||
end | ||
group = RSpec::Core::ExampleGroup.describe 'a view', type: :view do | ||
specify { true } | ||
specify { expect(true).to eq true } | ||
end | ||
group.run | ||
group.run(failure_reporter) | ||
expect(failure_reporter.exceptions).to eq [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not understand why we need the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its included for future debugging, we've had this spec fail before and its really hard to see why without this pattern, I'm going to use it in other places for the same reason. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! Maybe we could add a little bit of documentation on the top of file or somewhere? |
||
expect(run_count).to eq 1 | ||
end | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module RSpec::Rails::TestSupport | ||
class FailureReporter | ||
def initialize | ||
@exceptions = [] | ||
end | ||
attr_reader :exceptions | ||
|
||
def example_failed(example) | ||
@exceptions << example.exception | ||
end | ||
|
||
def method_missing(name, *_args, &_block) | ||
end | ||
end | ||
|
||
def failure_reporter | ||
@failure_reporter ||= FailureReporter.new | ||
end | ||
end | ||
|
||
RSpec.configure do |config| | ||
config.include RSpec::Rails::TestSupport | ||
end |
Uh oh!
There was an error while loading. Please reload this page.