Hi. I am very new to Rails and Cucumber so this may or may not be a quick fix.
I have a cucumber scenario that loads a collection of models and then checks to see if they are all rendered to a table. Cucumber returns a result saying "Tables were not identical". What am I missing here? I have tried to add headers in the second step definition but this does not help. Thank you.
Any additional tips and tricks for debugging rails and rails tests would also be helpful.
This is my scenario..
Scenario: View all the clients
Given I am on the clients page
And the following clients exist:
|name|mobile|address|
|Bob|93838383|21 Test Street|
|Ian|87232878|1 Test Road|
|Matt|23762327367|55 Rails Drive|
Then I should see the following clients:
|Bob|93838383|21 Test Street|
|Ian|87232878|1 Test Road|
|Matt|23762327367|55 Rails Drive|
and my step definitions...
Given /^the following clients exist:$/ do |table|
table.hashes.each do |client|
Client.create!(client)
end
end
Then /^I should see the following clients:$/ do |table|
table.diff!(tableish('table tr', 'td'))
end
and my view file..
<h1>Clients</h1>
<table>
<% for client in @clients %>
<tr>
<td><%= client.name %></td>
<td><%= client.mobile %></td>
<td><%= client.address %></td>
</tr>
<% end %>
</table>
And controller action..
def index
@clients = Client.find(:all)
end