Class: Pancake::Test::Matchers::MountMatcher
- Defined in:
- lib/pancake/test/matchers.rb
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected_app, path) ⇒ MountMatcher
constructor
A new instance of MountMatcher.
- #matches?(target) ⇒ Boolean
Constructor Details
#initialize(expected_app, path) ⇒ MountMatcher
Returns a new instance of MountMatcher.
5 6 7 |
# File 'lib/pancake/test/matchers.rb', line 5 def initialize(expected_app, path) @expected_app, @path = expected_app, path end |
Instance Method Details
#failure_message_for_should ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/pancake/test/matchers.rb', line 19 def if @ma "Expected #{@target} to mount #{@expected_app} at #{@path.inspect} but was mounted at #{@ma.mount_path.inspect}" else "Expected #{@target} to mount #{@expected_app} but it was not mounted" end end |
#failure_message_for_should_not ⇒ Object
27 28 29 30 31 |
# File 'lib/pancake/test/matchers.rb', line 27 def if @ma "Expected #{@target} to not implement #{@expected_app} at #{@path} but it was mounted there" end end |
#matches?(target) ⇒ Boolean
9 10 11 12 13 14 15 16 17 |
# File 'lib/pancake/test/matchers.rb', line 9 def matches?(target) @target = target @ma = @target::Router.mounted_applications.detect{|m| m.mounted_app == @expected_app} if @ma @ma.mounted_app == @expected_app && @ma.mount_path == @path else false end end |