-
Notifications
You must be signed in to change notification settings - Fork 71
/
app_spec.rb
42 lines (35 loc) · 1.01 KB
/
app_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require 'spec_helper'
describe CandyCheck::CLI::App do
subject { CandyCheck::CLI::App.new }
it 'supports the version command' do
stub_command(CandyCheck::CLI::Commands::Version) do
_(subject.version).must_equal :stubbed
_(@arguments).must_be_empty
end
end
it 'supports the app_store command' do
stub_command(CandyCheck::CLI::Commands::AppStore) do
_(subject.app_store('receipt')).must_equal :stubbed
_(@arguments).must_equal ['receipt']
end
end
it 'supports the play_store command' do
stub_command(CandyCheck::CLI::Commands::PlayStore) do
_(subject.play_store('package', 'id', 'token')).must_equal :stubbed
_(@arguments).must_equal ['package', 'id', 'token']
end
end
it 'returns true when call .exit_on_failure?' do
_(CandyCheck::CLI::App.exit_on_failure?).must_equal true
end
private
def stub_command(target)
stub = proc do |*args|
@arguments = args
:stubbed
end
target.stub :run, stub do
yield
end
end
end