Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on Oct 11, 2012
@jnunemaker jnunemaker Change key error to argument error.
Ruby 1.8 and 1.9 raise different errors for key missing when using
fetch.
ffb0d9d
@jnunemaker jnunemaker Added spec for sort value required keys da19e2f
View
2  lib/plucky/normalizers/options_hash_value.rb
@@ -7,7 +7,7 @@ module Normalizers
class OptionsHashValue
def initialize(args = {})
@key_normalizer = args.fetch(:key_normalizer) {
- raise KeyError, "Missing required argument :key_normalizer"
+ raise ArgumentError, "Missing required key :key_normalizer"
}
@value_normalizers = {
View
2  lib/plucky/normalizers/sort_value.rb
@@ -3,7 +3,7 @@ module Normalizers
class SortValue
def initialize(args = {})
- @key_normalizer = args.fetch(:key_normalizer) { raise KeyError, "Missing required argument :key_normalizer" }
+ @key_normalizer = args.fetch(:key_normalizer) { raise ArgumentError, "Missing required key :key_normalizer" }
end
# Public: Given a value returns it normalized for Mongo's sort option
View
2  spec/plucky/normalizers/options_hash_value_spec.rb
@@ -28,7 +28,7 @@
it "raises exception if missing key normalizer" do
expect {
described_class.new
- }.to raise_error(KeyError, "Missing required argument :key_normalizer")
+ }.to raise_error(ArgumentError, "Missing required key :key_normalizer")
end
it "allows injecting a new value normalizer" do
View
6 spec/plucky/normalizers/sort_value_spec.rb
@@ -12,6 +12,12 @@
})
}
+ it "raises exception if missing key normalizer" do
+ expect {
+ described_class.new
+ }.to raise_error(ArgumentError, "Missing required key :key_normalizer")
+ end
+
it "defaults to nil" do
subject.call(nil).should eq(nil)
end

No commit comments for this range

Something went wrong with that request. Please try again.