Sha256: 2322903b30887098540b0b9b9e3917d8e283fb68bf089299a90ed8bbf1bf6602

Contents?: true

Size: 738 Bytes

Versions: 13

Compression:

Stored size: 738 Bytes

Contents

require 'spec_helper'

describe Restforce::Middleware::Mashify do
  let(:app)        { double('app')            }
  let(:options)    { { } }
  let(:middleware) { described_class.new app, nil, options }

  before do
    app.should_receive(:call)
    middleware.call(env)
  end

  context 'when the body contains a records key' do
    let(:env) { { body: JSON.parse(fixture('sobject/query_success_response')) } }

    it 'converts the response body into a restforce collection' do
      env[:body].should be_a Restforce::Collection
    end
  end

  context 'when the body does not contain records' do
    let(:env) { { body: { 'foo' => 'bar' } } }

    it 'does not touch the body' do
      env[:body].foo.should eq 'bar'
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
restforce-0.1.4 spec/lib/middleware/mashify_spec.rb
restforce-0.1.3 spec/lib/middleware/mashify_spec.rb
restforce-0.1.2 spec/lib/middleware/mashify_spec.rb
restforce-0.1.1 spec/lib/middleware/mashify_spec.rb
restforce-0.1.0 spec/lib/middleware/mashify_spec.rb
restforce-0.0.8 spec/lib/middleware/mashify_spec.rb
restforce-0.0.7 spec/lib/middleware/mashify_spec.rb
restforce-0.0.6 spec/lib/middleware/mashify_spec.rb
restforce-0.0.5 spec/lib/middleware/mashify_spec.rb
restforce-0.0.4 spec/lib/middleware/mashify_spec.rb
restforce-0.0.3 spec/lib/middleware/mashify_spec.rb
restforce-0.0.2 spec/lib/middleware/mashify_spec.rb
restforce-0.0.1 spec/lib/middleware/mashify_spec.rb