Sha256: 5dfa12347be59a47f77325f67f74b3d0e787b4fa25bbbbe80a4edca0307cfeb8

Contents?: true

Size: 1.3 KB

Versions: 51

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

describe Galakei::Filter::ContentType do
  before :each do
    @filter = Galakei::Filter::ContentType.new
    @filter.controller = mock("controller")
    @request = mock("request")
    @response = mock("response")
    @filter.controller.stub!(:request).and_return(@request)
    @filter.controller.stub!(:response).and_return(@response)
  end
  describe "from docomo" do
    before { @request.should_receive(:docomo?).and_return(true) }
    describe "content type is text/html" do
      before { @response.should_receive(:content_type).and_return("text/html") }
      it("should require xhtml content type") do
        @filter.should be_condition
      end
    end
    describe "content type is image/png" do
      before { @response.should_receive(:content_type).and_return("image/png") }
      it("should not change content type") do
        @filter.should_not be_condition
      end
    end
    describe "304 response" do
      before { @response.should_receive(:content_type).and_return(nil) }
      it("should not change content type") do
        @filter.should_not be_condition
      end
    end
  end
  describe "from non docomo" do
    before { @request.should_receive(:docomo?).and_return(false) }
    it("should not change content type") do
      @filter.should_not be_condition
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
galakei-0.15.2 spec/galakei/filter/content_type_spec.rb
galakei-0.15.1 spec/galakei/filter/content_type_spec.rb
galakei-0.15.0 spec/galakei/filter/content_type_spec.rb
galakei-0.14.4 spec/galakei/filter/content_type_spec.rb
galakei-0.14.3 spec/galakei/filter/content_type_spec.rb
galakei-0.14.2 spec/galakei/filter/content_type_spec.rb
galakei-0.14.1 spec/galakei/filter/content_type_spec.rb
galakei-0.14.0 spec/galakei/filter/content_type_spec.rb
galakei-0.13.7 spec/galakei/filter/content_type_spec.rb
galakei-0.13.6 spec/galakei/filter/content_type_spec.rb
galakei-0.13.5 spec/galakei/filter/content_type_spec.rb
galakei-0.13.4 spec/galakei/filter/content_type_spec.rb
galakei-0.13.3 spec/galakei/filter/content_type_spec.rb
galakei-0.13.2 spec/galakei/filter/content_type_spec.rb
galakei-0.13.1 spec/galakei/filter/content_type_spec.rb
galakei-0.13.0 spec/galakei/filter/content_type_spec.rb
galakei-0.12.1 spec/galakei/filter/content_type_spec.rb
galakei-0.12.0 spec/galakei/filter/content_type_spec.rb
galakei-0.11.3 spec/galakei/filter/content_type_spec.rb
galakei-0.11.2 spec/galakei/filter/content_type_spec.rb