Sha256: e08b0da2e9294cc706d7a9fdc457925a2eb4fd778094460d260b53b9b7534682

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'

describe CandyCheck::CLI::Commands::PlayStore do
  include WithCommand
  subject { CandyCheck::CLI::Commands::PlayStore }
  let(:arguments) { [package, product_id, token, options] }
  let(:package)    { 'the_package' }
  let(:product_id) { 'the_product' }
  let(:token)      { 'the_token' }
  let(:options) do
    {
      application_name: 'YourApplication',
      application_version: '1.0',
      issuer: 'abcdefg@developer.gserviceaccount.com',
      key_file: 'local/google.p12',
      key_secret: 'notasecret'
    }
  end

  before do
    stub = proc do |*args|
      @verifier = DummyPlayStoreVerifier.new(*args)
    end
    CandyCheck::PlayStore::Verifier.stub :new, stub do
      run_command!
    end
  end

  it 'calls and outputs the verifier' do
    options.each do |k, v|
      @verifier.config.public_send(k).must_equal v
    end
    @verifier.arguments.must_equal [package, product_id, token]
    out.must_be 'Hash:', result: :stubbed
  end

  private

  DummyPlayStoreVerifier = Struct.new(:config) do
    attr_reader :arguments, :booted

    def boot!
      @booted = true
    end

    def verify(*arguments)
      @arguments = arguments
      { result: :stubbed }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
candy_check-0.1.2 spec/cli/commands/play_store_spec.rb
candy_check-0.1.1 spec/cli/commands/play_store_spec.rb
candy_check-0.1.0.pre spec/cli/commands/play_store_spec.rb
candy_check-0.0.5 spec/cli/commands/play_store_spec.rb