Skip to content

Commit

Permalink
fix ActionView::Base instantation for rails 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrunberg committed May 12, 2021
1 parent 5ff51ab commit a3beed7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@

def setup_adapter_for(framework, context = double(:context))
if framework == :rails
allow(context).to receive_messages(view_context: ActionView::Base.new)
# Rails 6.0 and 6.1 provide ActionView::Base.empty method that creates ActionView with an empty LookupContext.
# The method is not available on older versions
view_context = ActionView::Base.respond_to?(:empty) ? ActionView::Base.empty : ActionView::Base.new
allow(context).to receive_messages(view_context: view_context)
end

allow(SimpleNavigation).to receive_messages(framework: framework)
Expand Down

0 comments on commit a3beed7

Please sign in to comment.