Sha256: 4e8be3ddb38a0e34b4696dae2417789f92464bbad9f02424b92b97f03ef429cc

Contents?: true

Size: 1.37 KB

Versions: 7

Compression:

Stored size: 1.37 KB

Contents

require "spec_helper"

describe Spree::KomojuGateway, type: :model do
  subject { described_class.new }

  describe "#provider_class" do
    it { expect(subject.provider_class).to eq ActiveMerchant::Billing::KomojuGateway }
  end

  describe "#options" do
    it "returns options" do
      api_key = double("api_key")
      allow(subject).to receive(:preferred_api_key) { api_key }
      allow(subject).to receive(:preferred_test) { true }

      expect(subject.options).to eq ({ api_key: nil, test: true, server: "test", test_mode: true, login: api_key })
    end
  end

  describe "#auto_capture?" do
    it { expect(subject.auto_capture?).to be_falsy }
  end

  describe "#supports?" do
    it "returns true" do
      source = double("source")
      expect(subject.supports?(source)).to be_truthy
    end
  end

  describe "#change_options_to_dollar" do
    it "changes cents to dollar" do
      options = { shipping: 100, tax: 100, subtotal: 100, discount: 100 }

      expect(subject.change_options_to_dollar(options)).to eq ({ shipping: 1, tax: 1, subtotal: 1, discount: 1 })
    end
  end

  describe "#gateway_type" do
    it { expect(subject.gateway_type).to eq "gateway" }
  end

  describe "#method_type" do
    it { expect(subject.method_type).to eq "komoju_gateway" }
  end

  describe "#payment_source_class" do
    it { expect(subject.payment_source_class).to eq Spree::Gateway }
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spree_komoju-0.0.9 spec/models/spree/komoju_gateway_spec.rb
spree_komoju-0.0.8 spec/models/spree/komoju_gateway_spec.rb
spree_komoju-0.0.7 spec/models/spree/komoju_gateway_spec.rb
spree_komoju-0.0.6 spec/models/spree/komoju_gateway_spec.rb
spree_komoju-0.0.5 spec/models/spree/komoju_gateway_spec.rb
spree_komoju-0.0.4 spec/models/spree/komoju_gateway_spec.rb
spree_komoju-0.0.3 spec/models/spree/komoju_gateway_spec.rb