features/step_definitions/table_steps.rb in activeadmin-0.6.6 vs features/step_definitions/table_steps.rb in activeadmin-1.0.0.pre1
- old
+ new
@@ -1,7 +1,7 @@
Then /^I should see (\d+) ([\w]*) in the table$/ do |count, resource_type|
- all("table.index_table tr > td:first").count.should eq count.to_i
+ expect(all("table.index_table tr > td:first").count).to eq count.to_i
end
# TODO: simplify this, if possible?
class HtmlTableToTextHelper
def initialize(html, table_css_selector = "table")
@@ -89,13 +89,13 @@
end
end
def assert_cells_match(cell, expected_cell)
if expected_cell =~ /^\/.*\/$/
- cell.should match(Regexp.new(expected_cell[1..-2]))
+ expect(cell).to match /#{expected_cell[1..-2]}/
else
- (cell || "").strip.should == expected_cell
+ expect((cell || "").strip).to eq expected_cell
end
end
end # module TableMatchHelper
@@ -108,10 +108,10 @@
# | Invoice # | Date | Total Amount |
# | /\d+/ | 27/01/12 | $30.00 |
# | /\d+/ | 12/02/12 | $25.00 |
#
Then /^I should see the "([^"]*)" table:$/ do |table_id, expected_table|
- page.should have_css("table##{table_id}")
+ expect(page).to have_css "table##{table_id}"
assert_tables_match(
HtmlTableToTextHelper.new(page.body, "table##{table_id}").to_array,
expected_table.raw
)