Sha256: 82c8620b21f7a247c942f90f7de4f22ec496b35d42f762b5c25caa8009fa9a81

Contents?: true

Size: 738 Bytes

Versions: 24

Compression:

Stored size: 738 Bytes

Contents

module Lita
  module RSpec
    # A namespace to hold all of Lita's RSpec matchers.
    module Matchers
      # RSpec matchers for HTTP routes.
      # @since 4.0.0
      module HTTPRouteMatcher
        extend ::RSpec::Matchers::DSL

        matcher :route_http do |http_method, path|
          match do
            env = Rack::MockRequest.env_for(path, method: http_method)

            matching_routes = robot.app.recognize(env)

            if defined?(@method_name)
              matching_routes.include?(@method_name)
            else
              !matching_routes.empty?
            end
          end

          chain :to do |method_name|
            @method_name = method_name
          end
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
lita-4.8.0 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.8.0.beta1 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.7.1 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.7.0 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.6.1 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.6.0 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.5.0 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.4.3 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.4.2 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.4.1 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.4.0 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.3.2 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.3.1 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.3.0 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.2.1 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.2.0 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.1.0 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.0.4 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.0.3 lib/lita/rspec/matchers/http_route_matcher.rb
lita-4.0.2 lib/lita/rspec/matchers/http_route_matcher.rb