0

指定された ID を持つラベルの Calabash クエリの結果をアサーションしたいと考えています。しかし、'assert' メソッドは Calabash には存在しないようです。iOS アプリケーションをテストします。

私のコード:

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

これを行う方法?

よろしく、

ミハウ

4

1 に答える 1

1

これらのメソッドは、Calabash ではなく基本 Ruby スタックに存在します。Ruby の assert メソッドはhttp://ruby-doc.org/stdlib-2.0/libdoc/minitest/rdoc/MiniTest/Assertions.htmlにあります。

詳細はこちら: https://github.com/seattlerb/minitest

個人的には assert よりも Ruby の should 構文が好きです。最初にこの gem をインストールします。

gem install rspec-expectations

次に、features/support/env.rb で:

require 'rspec/expectations'

最後に、次のようにアサートできます。

departure_date_day.should eq query("label marked:'departure_date_day'", :text).first

は、expect() を支持して非推奨になっているはずです。私はまだそうすべきだと思っています...詳細はこちら: http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/

于 2015-03-13T21:35:04.003 に答える