Skip to content

Move #738 regression check to spec #1565

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

Merged
merged 1 commit into from
Feb 28, 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
23 changes: 0 additions & 23 deletions features/controller_specs/controller_spec.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,6 @@ Feature: controller spec
When I run `rspec spec`
Then the example should pass

Scenario: controller is extended with a helper module
Given a file named "spec/controllers/widgets_controller_spec.rb" with:
"""ruby
require "rails_helper"

module MyHelper
def my_variable
end
end

RSpec.configure {|c| c.include MyHelper }

RSpec.describe WidgetsController, :type => :controller do
let(:my_variable) { 'is a value' }

describe 'something' do
specify { expect(my_variable).to eq 'is a value' }
end
end
"""
When I run `rspec spec`
Then the example should pass

Scenario: setting a different content type for example json (request type)
Given a file named "spec/controllers/widgets_controller_spec.rb" with:
"""ruby
Expand Down
18 changes: 18 additions & 0 deletions spec/rspec/rails/example/controller_example_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ def group_for(klass)
allow(example).to receive_messages(:controller => controller)
expect(example.subject).to eq(controller)
end

it "doesn't cause let definition priority to be changed" do
# before #738 implicit subject definition for controllers caused
# external methods to take precedence over our let definitions

with_isolated_config do |config|
mod = Module.new do
def my_helper
"other_value"
end
end
config.include mod
group.class_exec do
let(:my_helper) { "my_value" }
end
expect(group.new.my_helper).to eq "my_value"
end
end
end

context "with explicit subject" do
Expand Down