Skip to content

Commit

Permalink
Added tests for MultipleChoiceExpectation.
Browse files Browse the repository at this point in the history
Test when parameter is present but is nil
  • Loading branch information
mjrode committed Apr 25, 2016
1 parent 73fab4a commit 5e1283c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/multiple_choice_expectation_test.rb
Expand Up @@ -26,6 +26,14 @@ class MultipleChoiceExpectation < Minitest::Test
end
end

should "parameters hash should pass when the second parameter is not nil" do
ex = MultipleChoiceExpectation.new([:name, :age, :id])
params = {age: 12}
assert_nothing_raised do
ex.verify(params)
end
end

should "parameters hash should pass even if some parameters are missing" do
ex = MultipleChoiceExpectation.new([:name, :age, :id])
params = {name: "Michael"}
Expand All @@ -42,4 +50,12 @@ class MultipleChoiceExpectation < Minitest::Test
end
end

should "parameters hash should fail if parameter is present and nil" do
ex = MultipleChoiceExpectation.new([:name, :age, :id])
params = {age: nil}
assert_raises (MissingParameterError) do
ex.verify(params)
end
end

end

0 comments on commit 5e1283c

Please sign in to comment.