Sha256: ce8a8a9987df5f7a8fc27dbd4406a041b6962b159df2f5964c4ab3afa1af2759
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true 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: status, headers: headers, body: body } context 'without Content-Type header' do let(:headers) { {} } it "fallbacks on 'text/plain'" do expect(response.content_type).to eq Mime[:text] end end context 'with JSON mimetype' do let(:mime_type) { 'application/json' } describe '#content_type' do it 'returns Mime::JSON' do expect(response.content_type).to eq Mime[:json] end end describe '#json?' do it 'returns 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 'returns Mime::JSON' do expect(response.content_type).to eq Mime[:json] end end describe '#json?' do it 'returns 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-2.0.0 | spec/acfs/response/formats_spec.rb |
acfs-1.7.0 | spec/acfs/response/formats_spec.rb |