Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Split argument checking tests into separate test cases, and added tes…

…t for collection checking
  • Loading branch information...
commit 12f820bcb67ac9f2e0cb0b93d6d1cbd1489b07c5 1 parent 7dfa6d6
Matt Southerden mattsoutherden authored
Showing with 17 additions and 15 deletions.
  1. +17 −15 test/table_helper_test.rb
32 test/table_helper_test.rb
View
@@ -12,25 +12,27 @@ def test_presence_of_instance_methods
end
end
- def test_should_fail_if_wrong_args
- assert_raise(ArgumentError) do
- tableize nil
+ def test_should_raise_argument_error_when_no_block_supplied
+ assert_raise(ArgumentError, "Missing block in tableize call") do
+ tableize [], :cols => 3
end
- assert_raise(ArgumentError) do
- tableize []
- end
- assert_raise(ArgumentError) do
- tableize nil, :name => 'main'
+ end
+
+ def test_should_raise_argument_error_when_less_than_2_columns_specified
+ assert_raise(ArgumentError, "Tableize columns must be two or more") do
+ tableize [], :cols => 1 do; end;
end
- assert_raise(ArgumentError) do
- tableize [], :name => 'main'
+ end
+
+ def test_should_raise_argument_error_when_collection_not_supplied
+ assert_raise(ArgumentError, "Missing collection parameter in tableize call") do
+ tableize nil, {} do; end;
end
- assert_raise(ArgumentError) do
- tableize [], :cols => 1, :name => :the_name do
- # nothing
- end
+
+ assert_raise(ArgumentError, "Missing collection parameter in tableize call") do
+ tableize nil, {:collection => nil} do; end;
end
- end
+ end
def test_block_invariance
assert_nothing_raised do
Please sign in to comment.
Something went wrong with that request. Please try again.