I'm testing a Rails 3.2.6 app.
Is it possible to make an Rspec/Capybara assertion that expresses, eg:
'If I ask for films between 1970 and 1990, the page should contain a film between those dates:'
For example
it "should show films in the the chosen date range" do
page.should have_selector '.year', # then something like text: range(1970..1990)
end
And conversely, can I check that no '.year' elements contain dates that are not in that range?
Thanks for any help.
Passing a block to have_selector didn't work, but within
did:
within('.year') do
text.to_i.should be_between(1970, 1990)
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With