Skip to content
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

Restore controller action hash separator #498

Conversation

garethrees
Copy link

The removal of the separator was introduced in 9e77440.

I believe this to be a regression, as do others in the Pull Request
comments [1].

Given the commit message, it doesn't appear that the author appreciated
the reasons behind the double hash.

Other specs assert that the controller and action name is separated by a
hash, not a space:

$ grep -r "home#index" test
test/exception_notifier/email_notifier_test.rb:    assert_equal '[Dummy ERROR] home#index (ZeroDivisionError) "divided by 0"', @mail.subject
test/exception_notifier/email_notifier_test.rb:      A ZeroDivisionError occurred in home#index:
test/exception_notifier/modules/formatter_test.rb:    assert_equal 'A *RuntimeError* occurred in *home#index*.', formatter.subtitle
test/exception_notifier/modules/formatter_test.rb:    assert_equal 'home#index', formatter.controller_and_action

$ grep -Er "#\{kontroller.controller_name\}##\{kontroller.action_name\}" test
test/exception_notifier/slack_notifier_test.rb:      text += " *was processed by* `#{kontroller.controller_name}##{kontroller.action_name}`" if kontroller

The test for EmailNotifier was introduced nearly 2 years later in
eb17362, so the regression was not caught at the time. The test author
mirrored the incorrect behaviour, presumably to get some improved level
of coverage based on the existing code.

[1] #398

The removal of the separator was introduced in 9e77440.

I believe this to be a regression, as do others in the Pull Request
comments [1].

Given the commit message, it doesn't appear that the author appreciated
the reasons behind the double hash.

Other specs assert that the controller and action name is separated by a
hash, not a space:

    $ grep -r "home#index" test
    test/exception_notifier/email_notifier_test.rb:    assert_equal '[Dummy ERROR] home#index (ZeroDivisionError) "divided by 0"', @mail.subject
    test/exception_notifier/email_notifier_test.rb:      A ZeroDivisionError occurred in home#index:
    test/exception_notifier/modules/formatter_test.rb:    assert_equal 'A *RuntimeError* occurred in *home#index*.', formatter.subtitle
    test/exception_notifier/modules/formatter_test.rb:    assert_equal 'home#index', formatter.controller_and_action

    $ grep -Er "#\{kontroller.controller_name\}##\{kontroller.action_name\}" test
    test/exception_notifier/slack_notifier_test.rb:      text += " *was processed by* `#{kontroller.controller_name}##{kontroller.action_name}`" if kontroller

The test for EmailNotifier was introduced nearly 2 years later in
eb17362, so the regression was not caught at the time. The test author
mirrored the incorrect behaviour, presumably to get some improved level
of coverage based on the existing code.

[1] smartinez87#398
@coveralls
Copy link

coveralls commented Aug 18, 2020

Coverage Status

Coverage remained the same at 96.936% when pulling 6db2212 on garethrees:restore-controller-action-hash-separator into cb6f1bc on smartinez87:master.

@smartinez87 smartinez87 merged commit 921961a into smartinez87:master Aug 18, 2020
@smartinez87
Copy link
Owner

thanks @garethrees for the contribution!

@garethrees
Copy link
Author

You're very welcome! 🙏

@garethrees
Copy link
Author

Any chance of a gem release to include this fix? 🍰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants