Skip to content

Commit

Permalink
ensure nil params don't get through
Browse files Browse the repository at this point in the history
  • Loading branch information
balvig committed Jan 17, 2015
1 parent 10f7a6e commit 9dce5de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/spyke/path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ def validate_required_params!
end

def missing_required_params
required_params - @params.keys
required_params - params_with_values
end

def params_with_values
@params.map do |key, value|
key if value.present?
end.compact
end

def required_params
Expand Down
2 changes: 1 addition & 1 deletion lib/spyke/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Spyke
VERSION = '1.7.0'
VERSION = '1.7.1'
end
6 changes: 6 additions & 0 deletions test/relation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,11 @@ def test_namespaced_model
assert_requested tip_endpoint
assert_requested likes_endpoint
end

def test_path_validation
assert_raises Spyke::InvalidPathError do
Recipe.new.groups.to_a
end
end
end
end

0 comments on commit 9dce5de

Please sign in to comment.