Commit 14daf2e2ba9d75527b5de07d87a9027bd53d607e
1 parent
2c95074a
Exists in
master
and in
4 other branches
Add `include_module` matcher
Showing
1 changed file
with
10 additions
and
0 deletions
Show diff stats
spec/support/matchers.rb
| @@ -28,6 +28,16 @@ RSpec::Matchers.define :be_404_for do |user| | @@ -28,6 +28,16 @@ RSpec::Matchers.define :be_404_for do |user| | ||
| 28 | end | 28 | end |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | +RSpec::Matchers.define :include_module do |expected| | ||
| 32 | + match do | ||
| 33 | + described_class.included_modules.include?(expected) | ||
| 34 | + end | ||
| 35 | + | ||
| 36 | + failure_message_for_should do | ||
| 37 | + "expected #{described_class} to include the #{expected} module" | ||
| 38 | + end | ||
| 39 | +end | ||
| 40 | + | ||
| 31 | module UrlAccess | 41 | module UrlAccess |
| 32 | def url_allowed?(user, url) | 42 | def url_allowed?(user, url) |
| 33 | emulate_user(user) | 43 | emulate_user(user) |