Skip to content

Commit

Permalink
Merge pull request #282 from cllns/add-note-about-dot-load!
Browse files Browse the repository at this point in the history
Improve NoAdapterError by mentioning `.load!`
  • Loading branch information
Trung Lê committed Jan 19, 2016
2 parents cfd8df3 + 18e3cbb commit 3e14c23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/lotus/model/adapters/null_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ module Adapters
# @since 0.2.0
class NoAdapterError < Lotus::Model::Error
def initialize(method_name)
super("Cannot invoke `#{ method_name }' on repository. Please check if `adapter' and `mapping' are set.")
super("Cannot invoke `#{ method_name }' on repository. "\
"Please check if `adapter' and `mapping' are set, "\
"and that you call `.load!' on the configuration.")
end
end

Expand Down
6 changes: 5 additions & 1 deletion test/integration/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
describe "when a repository isn't mapped" do
it 'raises an error when try to use it' do
exception = -> { UnmappedRepository.find(1) }.must_raise(Lotus::Model::Adapters::NoAdapterError)
exception.message.must_equal("Cannot invoke `find' on repository. Please check if `adapter' and `mapping' are set.")
exception.message.must_equal(
"Cannot invoke `find' on repository. "\
"Please check if `adapter' and `mapping' are set, "\
"and that you call `.load!' on the configuration."
)
end
end

Expand Down

0 comments on commit 3e14c23

Please sign in to comment.