Sha256: f17cb966ba8b252259ab18146bc54f72eb8640b8250f768e68087356829e9888

Contents?: true

Size: 921 Bytes

Versions: 8

Compression:

Stored size: 921 Bytes

Contents

require File.join(File.dirname(__FILE__), "../..", "example_helper.rb")
require 'relevance/core_extensions/file'

describe "Relevance::CoreExtensions::Response#html?" do
  before do
    @response = OpenStruct.new
    @response.extend(Relevance::CoreExtensions::Response)
  end         
  
  it "should be html if the content-type is 'text/html'" do
    @response.content_type = "text/html"
    @response.should be_html
    @response.content_type = "text/html;charset=iso-8859-2"
    @response.should be_html
  end

  it "should not be html if the content-type isn't an html type" do
    @response.content_type = "text/plain"
    @response.should_not be_html
  end

  # better ideas welcome, but be careful not to  
  # castrate tarantula for proxies that don't set the content-type
  it "should pretend we have html if the content-type is nil" do
    @response.content_type = nil
    @response.should be_html
  end
  
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
relevance-tarantula-0.1.0 examples/relevance/core_extensions/response_example.rb
relevance-tarantula-0.1.1 examples/relevance/core_extensions/response_example.rb
relevance-tarantula-0.1.2 examples/relevance/core_extensions/response_example.rb
relevance-tarantula-0.1.3 examples/relevance/core_extensions/response_example.rb
relevance-tarantula-0.1.4 examples/relevance/core_extensions/response_example.rb
relevance-tarantula-0.1.5 examples/relevance/core_extensions/response_example.rb
tarantula-0.1.4 examples/relevance/core_extensions/response_example.rb
tarantula-0.1.5 examples/relevance/core_extensions/response_example.rb