Skip to content

Commit

Permalink
Merge pull request #62 from voxik/fix-rails-6-compatibility
Browse files Browse the repository at this point in the history
Pass source to template separatedly.
  • Loading branch information
alexrothenberg committed Feb 24, 2021
2 parents 74146c4 + 54f8ce6 commit a3ccc6e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/ammeter/rspec/generator/matchers/have_correct_syntax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
require 'ostruct'

begin
view = ActionView::Template::Handlers::ERB.call(OpenStruct.new({:source => code}), code)
if Rails::VERSION::STRING < "6.0"
view = ActionView::Template::Handlers::ERB.call(OpenStruct.new(:source => code))
else
view = ActionView::Template::Handlers::ERB.call(OpenStruct.new, code)
end
eval('__crash_me__; ' + view)
rescue SyntaxError
false
Expand Down

0 comments on commit a3ccc6e

Please sign in to comment.