Skip to content

Commit

Permalink
Rails 6.1: ActionView::Base new now has 3 required arguments
Browse files Browse the repository at this point in the history
Fixes this error on 6.1 jasmine specs: `TEST_SUITE=spec:javascript bundle exec rake`

```
  #<ArgumentError: wrong number of arguments (given 0, expected 3)>
  /Users/joerafaniello/.gem/ruby/2.7.5/gems/actionview-6.1.6.1/lib/action_view/base.rb:230:in `initialize'
  /Users/joerafaniello/Code/manageiq-ui-classic/spec/javascripts/support/jasmine_helper.rb:18:in `new'
  /Users/joerafaniello/Code/manageiq-ui-classic/spec/javascripts/support/jasmine_helper.rb:18:in `call'
  /Users/joerafaniello/.gem/ruby/2.7.5/gems/rack-2.2.4/lib/rack/urlmap.rb:74:in `block in call'
```
  • Loading branch information
jrafanie committed Aug 12, 2022
1 parent f146171 commit 87f0386
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spec/javascripts/support/jasmine_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ def call(env)
return @rack_file.call(env) unless path.to_s.ends_with?('.haml')

raw = File.read(path)
scope = ActionView::Base.new
scope.controller = ActionController::Base.new
scope.view_paths << File.expand_path("../app/views", __FILE__)
lookup_context = ActionView::LookupContext.new(File.expand_path("../app/views", __FILE__))
controller = ActionController::Base.new

# Rails 6.1 ActionView::Base now has 3 required arguments
scope = ActionView::Base.new(lookup_context, [], controller)
scope.extend(ApplicationHelper)

compiled = hamlit_compile(raw, scope)
Expand Down

0 comments on commit 87f0386

Please sign in to comment.