Skip to content

Commit

Permalink
removed change in table state when using DataTable#symbolic_hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Behar committed Sep 16, 2017
1 parent 062f5b7 commit ee2bb9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cucumber/multiline_argument/data_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ def hashes
# [{:foo => '2', :bar => '3', :foo_bar => '5'}, {:foo => '7', :bar => '9', :foo_bar => '16'}]
#
def symbolic_hashes
@header_conversion_proc = lambda { |h| symbolize_key(h) }
@symbolic_hashes ||= build_hashes
@symbolic_hashes ||=
self.hashes.map do |string_hash|
Hash[string_hash.map{ |a,b| [symbolize_key(a), b] }]
end
end

# Converts this table into a Hash where the first column is
Expand Down
5 changes: 5 additions & 0 deletions spec/cucumber/multiline_argument/data_table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ module MultilineArgument
expect{@table.symbolic_hashes}.to_not raise_error
end

it 'should not interfere with use of #hashes' do
@table.symbolic_hashes
expect{@table.hashes}.to_not raise_error
end

end

describe '#map_column!' do
Expand Down

0 comments on commit ee2bb9a

Please sign in to comment.