|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
cucumber table diff haml problemInspired by the latest railscast I tried to do some table diffing:
But my problem is that the haml generated table does not produce the same html as the erb generated one. And table diffing seems to depend on a rather specific html table format my table diff step: [code] Then /^I should see the (.+) table$/ do |table_id, expected_table| html_table = table_at("##{table_id}").to_a html_table.map! { |r| r.map! { |c| c.gsub(/<.+?>/, '') } } expected_table.diff!(html_table) end [/code] erb code and output: [code] <table id="clients"> <% for client in @clients %> <tr> <td><%= client.name %></td> <td><%= client.number %></td> </tr> <% end %> </table> ## erb output <table id="clients"> <tr> <td>Client123</td> <td>123</td> </tr> <tr> <td>Client222/td> <td>222</td> </tr> [/code] And the difference with HAML is this: [code] %table#clients - for client in @clients %tr %td = client.name %td = client.number ##HAML output <tr> <td> Client123 </td> <td> 123 </td> </tr> [/code] Any ideas how I can get table diff working without leaving HAML for ERB? Thx Tick I hope this is readable, not sure if editing or bb is allowed here. -- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@... http://rubyforge.org/mailman/listinfo/rspec-users |
|
|
Re: cucumber table diff haml problemCucumber has its own mailing list now.
Can you please post there? http://groups.google.com/group/cukes Aslak On Tue, Nov 3, 2009 at 2:01 PM, Ray K. <lists@...> wrote: > Inspired by the latest railscast I tried to do some table diffing: > > But my problem is that the haml generated table does not produce the > same html as the erb generated one. And table diffing seems to depend on > a rather specific html table format > > my table diff step: > [code] > Then /^I should see the (.+) table$/ do |table_id, expected_table| > html_table = table_at("##{table_id}").to_a > html_table.map! { |r| r.map! { |c| c.gsub(/<.+?>/, '') } } > expected_table.diff!(html_table) > end > [/code] > > > erb code and output: > [code] > <table id="clients"> > <% for client in @clients %> > <tr> > <td><%= client.name %></td> > <td><%= client.number %></td> > </tr> > <% end %> > </table> > > > ## erb output > <table id="clients"> > <tr> > <td>Client123</td> > <td>123</td> > </tr> > <tr> > <td>Client222/td> > <td>222</td> > </tr> > [/code] > > > And the difference with HAML is this: > > [code] > %table#clients > - for client in @clients > %tr > %td > = client.name > %td > = client.number > > ##HAML output > <tr> > <td> > Client123 > </td> > > <td> > 123 > </td> > </tr> > [/code] > > > Any ideas how I can get table diff working without leaving HAML for ERB? > > Thx > Tick > > I hope this is readable, not sure if editing or bb is allowed here. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users@... > http://rubyforge.org/mailman/listinfo/rspec-users > rspec-users mailing list rspec-users@... http://rubyforge.org/mailman/listinfo/rspec-users |
|
|
Re: cucumber table diff haml problemwill do
-- Posted via http://www.ruby-forum.com/. _______________________________________________ rspec-users mailing list rspec-users@... http://rubyforge.org/mailman/listinfo/rspec-users |
| Free embeddable forum powered by Nabble | Forum Help |