Skip to content

Commit

Permalink
Merge pull request #13 from drewesk/131336127_about_keyword_arguments…
Browse files Browse the repository at this point in the history
…_master

131336127_about_keyword_arguments_master

[#131336127]
  • Loading branch information
jasonnoble authored Nov 13, 2016
2 parents 12c28c7 + 0a108fb commit fadbcd9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions about_keyword_arguments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ def method_with_keyword_arguments(one: 1, two: 'two')
end

def test_keyword_arguments
assert_equal __, method_with_keyword_arguments.class
assert_equal __, method_with_keyword_arguments
assert_equal __, method_with_keyword_arguments(one: 'one')
assert_equal __, method_with_keyword_arguments(two: 2)
assert_equal Array, method_with_keyword_arguments.class
assert_equal [1, "two"], method_with_keyword_arguments
assert_equal ["one", "two"], method_with_keyword_arguments(one: 'one')
assert_equal [1, 'two'], method_with_keyword_arguments()
end

def method_with_keyword_arguments_with_mandatory_argument(one, two: 2, three: 3)
[one, two, three]
end

def test_keyword_arguments_with_wrong_number_of_arguments
exception = assert_raise (___) do
exception = assert_raise (ArgumentError) do
method_with_keyword_arguments_with_mandatory_argument
end
assert_match(/__/, exception.message)
assert_match(/1/, exception.message)
end

# THINK ABOUT IT:
Expand Down

0 comments on commit fadbcd9

Please sign in to comment.