Sha256: 617ed449f824e46346a63389e423b66be2d181a60c8e4f0a8e31c3bcbd0a407a

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe Acfs::Response::Formats do
  let(:status)    { 200 }
  let(:mime_type) { 'application/unknown' }
  let(:headers)   { { 'Content-Type' => mime_type } }
  let(:request)   { Acfs::Request.new 'fubar' }
  let(:body)      { nil }
  let(:response)  { Acfs::Response.new request, status, headers, body }

  context 'with JSON mimetype' do
    let(:mime_type) { 'application/json' }

    describe '#content_type' do
      it 'should return Mime::JSON' do
        expect(response.content_type).to be == Mime::JSON
      end
    end

    describe '#json?' do
      it 'should return true' do
        expect(response).to be_json
      end
    end

    context 'with charset option' do
      let(:mime_type) { 'application/json; charset=utf8' }

      describe '#content_type' do
        it 'should return Mime::JSON' do
          expect(response.content_type).to be == Mime::JSON
        end
      end

      describe '#json?' do
        it 'should return true' do
          expect(response).to be_json
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acfs-0.7.0 spec/acfs/response/formats_spec.rb
acfs-0.6.0 spec/acfs/response/formats_spec.rb