Custom regex matcher for matchy
Gemfile:
group :test do
gem 'jnunemaker-matchy'
end
test_helper.rb:
class ActiveSupport::TestCase
custom_matcher :match do |receiver, matcher, args|
regex = args[0]
matcher.positive_failure_message = "Expected #{receiver} to match #{regex}"
matcher.negative_failure_message = "Expected #{receiver} not to match #{regex}"
receiver.match(regex) != nil
end
end
Your test:
current_path.should match(/\/admin\/companies\/.+/)