Sha256: 8646ef161ac092fccbab99432146a98b4f8a1176770767e6ee024ecb119b2a18

Contents?: true

Size: 595 Bytes

Versions: 1

Compression:

Stored size: 595 Bytes

Contents

RSpec::Matchers.define :have_rendered do
  match do |result|
    result.kind_of?(String) || result.kind_of?(Brut::FrontEnd::Templates::HTMLSafeString)
  end

  failure_message do |result|
    case result
    in URI => uri
      "Got a redirect to #{uri} instead of rendering"
    in Brut::FrontEnd::HttpStatus => http_status
      "Got an HTTP status of #{http_status} instead of rendering"
    else
      "Got an unexpected result: #{result.class} instead of a String"
    end
  end
  failure_message_when_negated do |result|
    "Result was rendered HTML instead of something else"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brut-0.0.1 lib/brut/spec_support/matchers/have_rendered.rb