Sha256: 123a471c15562c06375d6185aa5026e4a58349b100f2b9e503ebfe84f0552fc6

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

describe SalsaLabs::SupporterAction do
  it "returns action_key" do
    supporter_action = SalsaLabs::SupporterAction.new('action_key' => '123')

    expect(supporter_action.action_key).to eq(123)
  end

  it "returns nil for nil action_key" do
    supporter_action = SalsaLabs::SupporterAction.new({})

    expect(supporter_action.action_key).to be_nil
  end

  it "returns supporter_key" do
    supporter_action = SalsaLabs::SupporterAction.new('supporter_key' => '123')

    expect(supporter_action.supporter_key).to eq(123)
  end

  it "returns nil for nil supporter_key" do
    supporter_action = SalsaLabs::SupporterAction.new({})

    expect(supporter_action.supporter_key).to be_nil
  end

  it "returns supporter_action_key" do
    supporter_action = SalsaLabs::SupporterAction.new('supporter_action_key' => '123')

    expect(supporter_action.supporter_action_key).to eq(123)
  end

  it "returns nil for nil supporter_action_key" do
    supporter_action = SalsaLabs::SupporterAction.new({})

    expect(supporter_action.supporter_action_key).to be_nil
  end

  describe ".fetch" do
    it "fetches the supporter actions" do
      SalsaLabs::ObjectsFetcher.stub(:fetch)

      SalsaLabs::SupporterAction.fetch(email: "foo@bar.com",
                                       password: "pass")

      expect(SalsaLabs::ObjectsFetcher).to have_received(:fetch).with(
        credentials: {email: "foo@bar.com", password: "pass"},
        type: "supporter_action",
        item_class: SalsaLabs::SupporterAction)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
salsa_labs-0.0.6 spec/salsa_labs/supporter_action_spec.rb
salsa_labs-0.0.5 spec/salsa_labs/supporter_action_spec.rb
salsa_labs-0.0.4 spec/salsa_labs/supporter_action_spec.rb
salsa_labs-0.0.3 spec/salsa_labs/supporter_action_spec.rb