I want to make assertion of the results of Calabash queries for labels with given ids. But the 'assert' method seems to not exist in Calabash. I test an iOS application.
My code:
Then(/^arrival date has been changed to day after departure date$/) do
departure_date_day = query("label marked:'departure_date_day'", :text).first
arrival_date_day = query("label marked:'arrival_date_day'", :text ()).first
# assert arrival_date_day.to_i == departure_date_day.to_i + 1
end
How to do this?
Regards,
Michał
These methods exist in the base Ruby stack rather than Calabash. You can find Ruby's assert methods here: http://ruby-doc.org/stdlib-2.0/libdoc/minitest/rdoc/MiniTest/Assertions.html
More information is here: https://github.com/seattlerb/minitest
Rather than use assert, I personally like Ruby's 'should' syntax. First install this gem:
gem install rspec-expectations
then in features/support/env.rb:
require 'rspec/expectations'
finally, you can assert like so:
departure_date_day.should eq query("label marked:'departure_date_day'", :text).first
Should has been deprecated in favor of expect(). I still prefer should ... more info is here: http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/