Skip to content

Commit

Permalink
Do not use NotImplementedError
Browse files Browse the repository at this point in the history
Instead use NoMethodError as to indicate that the method should be
defined in the class

Closes varvet#775
  • Loading branch information
hallelujah authored and Burgestrand committed Oct 12, 2023
1 parent af78b44 commit 6eec6c6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Unreleased

Nothing.
- Policy generator uses `NoMethodError` to indicate `#resolve` is not implemented (#776)

## 2.3.1 (2023-07-17)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def initialize(user, scope)
end

def resolve
raise NotImplementedError, "You must define #resolve in #{self.class}"
raise NoMethodError, "You must define #resolve in #{self.class}"
end

private
Expand Down
2 changes: 1 addition & 1 deletion spec/generators_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
describe "#resolve" do
it "raises a descriptive error" do
scope = WidgetPolicy::Scope.new(double("User"), double("User.all"))
expect { scope.resolve }.to raise_error(NotImplementedError, /WidgetPolicy::Scope/)
expect { scope.resolve }.to raise_error(NoMethodError, /WidgetPolicy::Scope/)
end
end
end
Expand Down

0 comments on commit 6eec6c6

Please sign in to comment.