Sha256: e2d6d732b0a8f07b400ef56451fe326e26ee9af1ebc10618e002a25300872365

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe PurposePlatformQueuedClient::Action do
  subject { PurposePlatformQueuedClient.new(host: 'test.com') }

  before(:each) do
    logger = double
    allow(logger).to receive(:debug).and_return(true)

    allow(PurposePlatformQueuedClient).to receive(:logger).and_return(logger)
    allow(Vertebrae::Base).to receive(:logger).and_return(logger)
  end

  let(:request_body) { {"guard"=>"", "hp_enabled"=>"true", "member"=>{"email"=>"george@washington.com", "first_name"=>"George", "last_name"=>"Washington", "postcode"=>"11238"}, "org"=>"foo"}}
  let(:request_path) { '/action' }
  let(:body) {'{"foo": "bar"}'}

  describe "success" do
    let(:status) { 200 }

    before(:each) do
      stub_post(request_path).with(body: request_body).to_return(:body => body, :status => status,
                                       :headers => {:content_type => "application/json; charset=utf-8"})
    end

    it "should return a single object" do
      subject.action.create(member: {first_name: 'George', last_name: 'Washington', email: 'george@washington.com', postcode: '11238'}, org: 'foo')

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
purpose-platform-queued-client-0.1.1 spec/action_spec.rb
purpose-platform-queued-client-0.0.3 spec/action_spec.rb