Sha256: d6fa73f4e05f3e1a7bd7aa2b564475bde33154dbbe8b5eb1a369f16023344560
Contents?: true
Size: 1010 Bytes
Versions: 7
Compression:
Stored size: 1010 Bytes
Contents
# frozen_string_literal: true require 'test_helper' class NameErrorHandlingTest < ActionDispatch::IntegrationTest setup do aamine = Author.create! name: 'aamine' @rhg = aamine.books.create! title: 'RHG' end test 'raising NameError in a decorator' do err = assert_raises ActionView::Template::Error do visit "/authors/#{@rhg.author.id}/books/#{@rhg.id}/errata" end assert_match(/undefined method `poof!' for/, err.message) assert_match 'poof!', err.cause.name if err.respond_to?(:cause) end test "Don't touch NameError that was not raised from a decorator module but from other classes" do err = assert_raises ActionView::Template::Error do visit "/authors/#{@rhg.author.id}/books/#{@rhg.id}/errata2" end assert_match(/undefined method `boom!' for/, err.message) assert_match 'boom!', err.cause.name if err.respond_to?(:cause) assert_not_match(/active_decorator\/lib\/active_decorator\/.* in method_missing'$/, err.backtrace[0]) end end
Version data entries
7 entries across 7 versions & 1 rubygems