Sha256: ce7ca50083f5234fed3b356b43cae4d409a743d9611a13d134c6aeee4c7e9b83

Contents?: true

Size: 1.11 KB

Versions: 16

Compression:

Stored size: 1.11 KB

Contents

module Pancake
  module Test
    module Matchers
      class MountMatcher
        def initialize(expected_app, path)
          @expected_app, @path = expected_app, path
        end

        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

        def failure_message_for_should
          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

        def failure_message_for_should_not
          if @ma
            "Expected #{@target} to not implement #{@expected_app} at #{@path} but it was mounted there"
          end
        end
      end # MountMatcher

      def mount(expected, path)
        MountMatcher.new(expected, path)
      end
    end # Matchers
  end # Test
end # Pancake

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
pancake-0.2.0 lib/pancake/test/matchers.rb
pancake-0.1.29 lib/pancake/test/matchers.rb
pancake-0.1.28 lib/pancake/test/matchers.rb
pancake-0.1.27 lib/pancake/test/matchers.rb
pancake-0.1.26 lib/pancake/test/matchers.rb
pancake-0.1.25 lib/pancake/test/matchers.rb
pancake-0.1.24 lib/pancake/test/matchers.rb
pancake-0.1.22 lib/pancake/test/matchers.rb
pancake-0.1.20 lib/pancake/test/matchers.rb
pancake-0.1.19 lib/pancake/test/matchers.rb
pancake-0.1.18 lib/pancake/test/matchers.rb
pancake-0.1.17 lib/pancake/test/matchers.rb
pancake-0.1.16 lib/pancake/test/matchers.rb
pancake-0.1.15 lib/pancake/test/matchers.rb
pancake-0.1.13 lib/pancake/test/matchers.rb
pancake-0.1.12 lib/pancake/test/matchers.rb