Permalink
Browse files

Addint unit test to prove problem

  • Loading branch information...
1 parent bf44786 commit 1de63d285eeb7f4e3587c287d7a20d3185c720a2 @chrisbloom7 committed Apr 30, 2012
Showing with 35 additions and 1 deletion.
  1. +35 −1 spec/cucumber/ast/table_spec.rb
@@ -54,7 +54,7 @@ def @table.columns; super; end
@table.map_column!('one') { |v| v.to_i }
@table.hashes.first['one'].should == 4444
end
-
+
it "applies the block once to each value" do
headers = ['header']
rows = ['value']
@@ -200,7 +200,41 @@ def @table.columns; super; end
table.hashes.first.keys.should =~ %w[hello foo]
end
+
+ it "should allow mapping of headers before table.hashes has been accessed" do
+ table = Table.new([
+ ['HELLO', 'WORLD'],
+ %w{4444 55555}
+ ])
+ table.map_headers! do |header|
+ header.downcase
+ end
+
+
+ pp table.headers
+ pp table.hashes.first.keys
+
+ table.hashes.first.keys.should =~ %w[hello world]
+ end
+
+ it "should allow mapping of headers after table.hashes has been accessed" do
+ table = Table.new([
+ ['HELLO', 'WORLD'],
+ %w{4444 55555}
+ ])
+
+ dev_null = table.hashes.size
+
+ table.map_headers! do |header|
+ header.downcase
+ end
+
+ pp table.headers
+ pp table.hashes.first.keys
+
+ table.hashes.first.keys.should =~ %w[hello world]
+ end
end
describe "replacing arguments" do

0 comments on commit 1de63d2

Please sign in to comment.