ruby on rails - Capybara warning: ignoring the provided expectation [...] since it is not a string or a proc -
i use rspec , capybar test applicaiton. in 1 of feature spec want assert field has value. when use capybara's find_field strange behavior. (the below code runs capybara-webkit since field value rendered angularjs, if of importance).
this code works fine:
expect(find('input[name=ordered_quantity]').value).to eq '0' but rather use find_field ..., with: ... method, think bit cleaner find(...).value. following code passes, warning, indicates ignoring with filter:
is_expected.to have_field('ordered_quantity'), with: '0' # => warning: ignoring provided expectation message argument ({:with=>"0"}) since not string or proc. the following code (input[name=ordered_quantity] added) both fails , gives me warning:
is_expected.to have_field('input[name=ordered_quantity]'), with: '0' # => warning: ignoring provided exptheectation message argument ({:with=>"0"}) since not string or proc. there 1 occurrence of ordered_quantity on page , field want test.
try put with: '0' inside of have_field method:
is_expected.to have_field('ordered_quantity', with: '0')
Comments
Post a Comment