Skip to content

Commit

Permalink
Merge pull request #776 from hallelujah/775-use-NomethodError
Browse files Browse the repository at this point in the history
Do not use NotImplementedError
  • Loading branch information
Burgestrand authored Oct 12, 2023
2 parents af78b44 + 6eec6c6 commit 4d8cdf1
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 4d8cdf1

Please sign in to comment.