Sha256: 9bc4c731e884cb4cc1dfbf2280a04a9e36b8ecf43cf89918bdebeb8882d5c527

Contents?: true

Size: 834 Bytes

Versions: 3

Compression:

Stored size: 834 Bytes

Contents

module Spec
  module Integration
    module Matchers
      class HaveLinkTo # :nodoc:
        include ActionController::RecordIdentifier
        
        def initialize(href, example)
          @href = href
          @example = example
        end
        
        def matches?(response)
          response.should @example.have_tag('a[href=?]', @href)
          true
        rescue
          false
        end
        
        def failure_message
          "expected to find a link to #{@href} but none was found"
        end
        
        def negative_failure_message
          "expected not to find a link to #{@href}"
        end
      end
      
      # Specify that a response should have a link with the specified href value.
      #
      def have_link_to(href)
        HaveLinkTo.new(href, self)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
radiant-0.7.2 vendor/plugins/spec_integration/lib/spec/integration/matchers/have_link_to.rb
radiant-0.7.0 vendor/plugins/spec_integration/lib/spec/integration/matchers/have_link_to.rb
radiant-0.7.1 vendor/plugins/spec_integration/lib/spec/integration/matchers/have_link_to.rb