I was doing
expect(@link.url_address == 'abc').to be_true
but url_address might have other text after abc
so I am trying
expect(@link.url_address =~ 'abc').to be_true
but I am getting
Failure/Error: expect(@link.url_address =~ /abc/).to be_true
expected to respond to `true?`
I also tried
expect(@link.url_address).to =~ /abc/
but I get
Failure/Error: expect(@link.url_address).to =~ /abc/
ArgumentError:
The expect syntax does not support operator matchers, so you must pass a matcher to `#to`.
Try this:
expect(@link.url_address).to match(/abc/)
Source: https://github.com/rspec/rspec-expectations#regular-expressions
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