Permalink
Browse files

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

…t for collection checking
  • Loading branch information...
1 parent 7dfa6d6 commit 12f820bcb67ac9f2e0cb0b93d6d1cbd1489b07c5 @mattsoutherden mattsoutherden committed Nov 30, 2009
Showing with 17 additions and 15 deletions.
  1. +17 −15 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

0 comments on commit 12f820b

Please sign in to comment.