tddium-preview 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/tddium.rb +34 -5
- data/lib/tddium/constant.rb +8 -0
- data/lib/tddium/heroku.rb +28 -20
- data/lib/tddium/version.rb +1 -1
- data/spec/heroku_spec.rb +14 -12
- data/spec/tddium_spec.rb +94 -87
- metadata +41 -1
data/Gemfile.lock
CHANGED
data/lib/tddium.rb
CHANGED
@@ -33,16 +33,11 @@ class Tddium < Thor
|
|
33
33
|
method_option :email, :type => :string, :default => nil
|
34
34
|
method_option :password, :type => :string, :default => nil
|
35
35
|
method_option :ssh_key_file, :type => :string, :default => nil
|
36
|
-
method_option :app, :type => :string, :default => nil
|
37
36
|
def account
|
38
37
|
set_default_environment(options[:environment])
|
39
38
|
if user_details = user_logged_in?
|
40
39
|
# User is already logged in, so just display the info
|
41
40
|
show_user_details(user_details)
|
42
|
-
elsif heroku_config = HerokuConfig.read_config(options[:app])
|
43
|
-
# User has logged in to heroku, and TDDIUM environment variables are
|
44
|
-
# present
|
45
|
-
handle_heroku_user(options, heroku_config)
|
46
41
|
else
|
47
42
|
params = get_user_credentials(options.merge(:invited => true))
|
48
43
|
|
@@ -77,6 +72,39 @@ class Tddium < Thor
|
|
77
72
|
end
|
78
73
|
end
|
79
74
|
|
75
|
+
desc "heroku", "Connect Heroku account with Tddium"
|
76
|
+
method_option :environment, :type => :string, :default => nil
|
77
|
+
method_option :email, :type => :string, :default => nil
|
78
|
+
method_option :password, :type => :string, :default => nil
|
79
|
+
method_option :ssh_key_file, :type => :string, :default => nil
|
80
|
+
method_option :app, :type => :string, :default => nil
|
81
|
+
def heroku
|
82
|
+
set_default_environment(options[:environment])
|
83
|
+
if user_details = user_logged_in?
|
84
|
+
# User is already logged in, so just display the info
|
85
|
+
show_user_details(user_details)
|
86
|
+
else
|
87
|
+
begin
|
88
|
+
heroku_config = HerokuConfig.read_config(options[:app])
|
89
|
+
# User has logged in to heroku, and TDDIUM environment variables are
|
90
|
+
# present
|
91
|
+
handle_heroku_user(options, heroku_config)
|
92
|
+
rescue HerokuConfig::HerokuNotFound
|
93
|
+
gemlist = `gem list heroku`
|
94
|
+
msg = Text::Error::Heroku::NOT_FOUND % gemlist
|
95
|
+
exit_failure msg
|
96
|
+
rescue HerokuConfig::TddiumNotAdded
|
97
|
+
exit_failure Text::Error::Heroku::NOT_ADDED
|
98
|
+
rescue HerokuConfig::InvalidFormat
|
99
|
+
exit_failure Text::Error::Heroku::INVALID_FORMAT
|
100
|
+
rescue HerokuConfig::NotLoggedIn
|
101
|
+
exit_failure Text::Error::Heroku::NOT_LOGGED_IN
|
102
|
+
rescue HerokuConfig::AppNotFound
|
103
|
+
exit_failure Text::Error::Heroku::APP_NOT_FOUND % options[:app]
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
80
108
|
desc "password", "Change password"
|
81
109
|
method_option :environment, :type => :string, :default => nil
|
82
110
|
def password
|
@@ -526,6 +554,7 @@ class Tddium < Thor
|
|
526
554
|
say "Recurly Management URL: " + api_response["user"]["recurly_url"]
|
527
555
|
say "CI Public Key: " + api_response["user"]["ci_ssh_pubkey"] if api_response["user"]["ci_ssh_pubkey"]
|
528
556
|
say "Suites: " + api_response["user"]["suites"] if api_response["user"]["suites"]
|
557
|
+
say "Heroku Account Linked: #{api_response["user"]["heroku_activation_done"]}" if api_response["user"]["heroku"]
|
529
558
|
end
|
530
559
|
|
531
560
|
def show_ci_info(api_response)
|
data/lib/tddium/constant.rb
CHANGED
@@ -148,6 +148,14 @@ http://blog.tddium.com/home/
|
|
148
148
|
NO_MATCHING_FILES = "No files match '%s'"
|
149
149
|
PASSWORD_ERROR = "Error changing password: %s"
|
150
150
|
HEROKU_MISCONFIGURED = "There was an error linking your Heroku account to Tddium: %s"
|
151
|
+
module Heroku
|
152
|
+
NOT_FOUND = "heroku command not found. Make sure the latest heroku gem is installed.\nOutput of `gem list heroku`:\n%s"
|
153
|
+
NOT_ADDED = "It looks like you haven't enabled the tddium addon. Add it using 'heroku addons:add tddium'"
|
154
|
+
INVALID_FORMAT = "The 'heroku -s' command output a format we didn't recognize. Make sure you're running the latest version of the heroku gem"
|
155
|
+
NOT_LOGGED_IN = "Log in to your heroku account first using 'heroku login'"
|
156
|
+
APP_NOT_FOUND = "The app '%s' is not recognized by Heroku"
|
157
|
+
end
|
158
|
+
|
151
159
|
end
|
152
160
|
end
|
153
161
|
|
data/lib/tddium/heroku.rb
CHANGED
@@ -5,31 +5,39 @@ Copyright (c) 2011 Solano Labs All Rights Reserved
|
|
5
5
|
require 'timeout'
|
6
6
|
|
7
7
|
class HerokuConfig
|
8
|
+
class HerokuError < RuntimeError; end
|
9
|
+
class HerokuNotFound < HerokuError; end
|
10
|
+
class TddiumNotAdded < HerokuError; end
|
11
|
+
class InvalidFormat < HerokuError; end
|
12
|
+
class NotLoggedIn < HerokuError; end
|
13
|
+
class AppNotFound < HerokuError; end
|
14
|
+
|
8
15
|
REQUIRED_KEYS = %w{TDDIUM_API_KEY TDDIUM_USER_NAME}
|
9
16
|
def self.read_config(app=nil)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
command = "heroku config -s"
|
15
|
-
command += " --app #{app}" if app
|
17
|
+
config = {}
|
18
|
+
|
19
|
+
command = "heroku config -s"
|
20
|
+
command += " --app #{app}" if app
|
16
21
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
22
|
+
begin
|
23
|
+
output = `#{command} < /dev/null 2>&1`
|
24
|
+
rescue Errno::ENOENT
|
25
|
+
raise HerokuNotFound
|
26
|
+
end
|
27
|
+
raise HerokuNotFound if output =~ /heroku: not found/
|
28
|
+
raise AppNotFound if output =~ /App not found/
|
29
|
+
raise InvalidFormat if output.length == 0
|
30
|
+
raise NotLoggedIn if output =~ /Heroku credentials/
|
21
31
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
32
|
+
output.lines.each do |line|
|
33
|
+
line.chomp!
|
34
|
+
k, v = line.split('=')
|
35
|
+
if k =~ /^TDDIUM_/ && v.length > 0
|
36
|
+
config[k] = v
|
28
37
|
end
|
29
|
-
return nil if REQUIRED_KEYS.inject(false) {|missing, x| missing || !config[x]}
|
30
|
-
result = config if config.keys.length > 0
|
31
|
-
rescue
|
32
38
|
end
|
33
|
-
|
39
|
+
raise TddiumNotAdded if config.keys.length == 0
|
40
|
+
raise InvalidFormat if REQUIRED_KEYS.inject(false) {|missing, x| missing || !config[x]}
|
41
|
+
config
|
34
42
|
end
|
35
43
|
end
|
data/lib/tddium/version.rb
CHANGED
data/spec/heroku_spec.rb
CHANGED
@@ -18,10 +18,11 @@ TDDIUM_API_KEY=abcdefg
|
|
18
18
|
SAMPLE_HEROKU_CONFIG_NO_TDDIUM = "
|
19
19
|
DB_URL=postgres://foo/bar
|
20
20
|
"
|
21
|
+
SAMPLE_HEROKU_COMMAND = "heroku config -s < /dev/null 2>&1"
|
21
22
|
describe ".read_config" do
|
22
23
|
context "addon installed" do
|
23
24
|
before do
|
24
|
-
HerokuConfig.stub(:`).with(
|
25
|
+
HerokuConfig.stub(:`).with(SAMPLE_HEROKU_COMMAND).and_return(SAMPLE_HEROKU_CONFIG_TDDIUM)
|
25
26
|
end
|
26
27
|
|
27
28
|
it "should return a hash of the TDDIUM config vars" do
|
@@ -38,8 +39,9 @@ DB_URL=postgres://foo/bar
|
|
38
39
|
|
39
40
|
context "with app specified" do
|
40
41
|
before do
|
41
|
-
|
42
|
-
HerokuConfig.
|
42
|
+
cmd = "heroku config -s --app #{SAMPLE_APP} < /dev/null 2>&1"
|
43
|
+
HerokuConfig.stub(:`).with(cmd).and_return(SAMPLE_HEROKU_CONFIG_TDDIUM)
|
44
|
+
HerokuConfig.should_receive(:`).with(cmd)
|
43
45
|
end
|
44
46
|
|
45
47
|
it "should pass the app to heroku config" do
|
@@ -50,30 +52,30 @@ DB_URL=postgres://foo/bar
|
|
50
52
|
|
51
53
|
context "missing config" do
|
52
54
|
before do
|
53
|
-
HerokuConfig.stub(:`).with(
|
55
|
+
HerokuConfig.stub(:`).with(SAMPLE_HEROKU_COMMAND).and_return(SAMPLE_HEROKU_CONFIG_PARTIAL)
|
54
56
|
end
|
55
57
|
|
56
|
-
it "should
|
57
|
-
HerokuConfig.read_config.
|
58
|
+
it "should raise InvalidFormat" do
|
59
|
+
expect { HerokuConfig.read_config }.to raise_error(HerokuConfig::InvalidFormat)
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
61
63
|
context "addon not installed" do
|
62
64
|
before do
|
63
|
-
HerokuConfig.stub(:`).with(
|
65
|
+
HerokuConfig.stub(:`).with(SAMPLE_HEROKU_COMMAND).and_return(SAMPLE_HEROKU_CONFIG_NO_TDDIUM)
|
64
66
|
end
|
65
67
|
|
66
|
-
it "should
|
67
|
-
HerokuConfig.read_config.
|
68
|
+
it "should raise NotAdded" do
|
69
|
+
expect { HerokuConfig.read_config }.to raise_error(HerokuConfig::TddiumNotAdded)
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
71
73
|
context "heroku not installed" do
|
72
74
|
before do
|
73
|
-
HerokuConfig.stub(:`).with(
|
75
|
+
HerokuConfig.stub(:`).with(SAMPLE_HEROKU_COMMAND).and_raise(Errno::ENOENT)
|
74
76
|
end
|
75
|
-
it "should
|
76
|
-
HerokuConfig.read_config.
|
77
|
+
it "should raise HerokuNotFound" do
|
78
|
+
expect { HerokuConfig.read_config }.to raise_error(HerokuConfig::HerokuNotFound)
|
77
79
|
end
|
78
80
|
end
|
79
81
|
end
|
data/spec/tddium_spec.rb
CHANGED
@@ -74,20 +74,41 @@ describe Tddium do
|
|
74
74
|
send("run_#{method}", tddium, options)
|
75
75
|
end
|
76
76
|
|
77
|
-
[:suite, :spec, :status, :account, :login, :logout, :password].each do |method|
|
78
|
-
|
77
|
+
[:suite, :spec, :status, :account, :login, :logout, :password, :heroku].each do |method|
|
78
|
+
def prep_params(method, params=nil)
|
79
79
|
options = params.first || {}
|
80
80
|
if method == :spec
|
81
81
|
options[:test_pattern] = DEFAULT_TEST_PATTERN unless options.has_key?(:test_pattern)
|
82
|
-
stub_exit_failure
|
83
82
|
end
|
84
83
|
options[:environment] = "test" unless options.has_key?(:environment)
|
84
|
+
options
|
85
|
+
end
|
86
|
+
|
87
|
+
define_method("run_#{method}") do |tddium, *params|
|
88
|
+
options = prep_params(method, params)
|
89
|
+
stub_exit_failure
|
85
90
|
stub_cli_options(tddium, options)
|
86
91
|
begin
|
87
92
|
tddium.send(method)
|
88
93
|
rescue EXIT_FAILURE_EXCEPTION
|
89
94
|
end
|
90
95
|
end
|
96
|
+
|
97
|
+
define_method("#{method}_should_fail") do |tddium, *params|
|
98
|
+
options = prep_params(method, params)
|
99
|
+
stub_cli_options(tddium, options)
|
100
|
+
tddium.stub(:exit_failure).and_raise(SystemExit)
|
101
|
+
yield if block_given?
|
102
|
+
expect { tddium.send(method) }.to raise_error(SystemExit)
|
103
|
+
end
|
104
|
+
|
105
|
+
define_method("#{method}_should_pass") do |tddium, *params|
|
106
|
+
options = prep_params(method, params)
|
107
|
+
stub_cli_options(tddium, options)
|
108
|
+
tddium.stub(:exit_failure).and_raise(SystemExit)
|
109
|
+
yield if block_given?
|
110
|
+
expect { tddium.send(method) }.not_to raise_error
|
111
|
+
end
|
91
112
|
end
|
92
113
|
|
93
114
|
def stub_bundler_version(tddium, version = SAMPLE_BUNDLER_VERSION)
|
@@ -462,63 +483,30 @@ describe Tddium do
|
|
462
483
|
end
|
463
484
|
end
|
464
485
|
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
create_file(File.join(File.dirname(__FILE__), "..", Tddium::License::FILE_NAME), SAMPLE_LICENSE_TEXT)
|
471
|
-
create_file(Tddium::Default::SSH_FILE, SAMPLE_SSH_PUBKEY)
|
472
|
-
HerokuConfig.stub(:read_config).and_return(nil)
|
473
|
-
end
|
474
|
-
|
475
|
-
it_should_behave_like "set the default environment"
|
476
|
-
|
477
|
-
context "the user is already logged in" do
|
478
|
-
before do
|
479
|
-
stub_config_file(:api_key => SAMPLE_API_KEY)
|
480
|
-
stub_call_api_response(:get, Tddium::Api::Path::USERS, SAMPLE_USER_RESPONSE)
|
481
|
-
end
|
482
|
-
|
483
|
-
it "should show the user's email address" do
|
484
|
-
tddium.should_receive(:say).with(/#{SAMPLE_EMAIL}/)
|
485
|
-
run_account(tddium)
|
486
|
-
end
|
487
|
-
|
488
|
-
it "should show the user's account creation date" do
|
489
|
-
tddium.should_receive(:say).with(/#{SAMPLE_DATE_TIME}/)
|
490
|
-
run_account(tddium)
|
491
|
-
end
|
492
|
-
|
493
|
-
it "should show the user's recurly account url" do
|
494
|
-
tddium.should_receive(:say).with(/#{SAMPLE_RECURLY_URL}/)
|
495
|
-
run_account(tddium)
|
486
|
+
shared_examples_for "prompt for ssh key" do
|
487
|
+
context "--ssh-key-file is not supplied" do
|
488
|
+
it "should prompt the user for their ssh key file" do
|
489
|
+
tddium.should_receive(:ask).with(Tddium::Text::Prompt::SSH_KEY % Tddium::Default::SSH_FILE)
|
490
|
+
run(tddium)
|
496
491
|
end
|
497
|
-
|
498
492
|
end
|
499
493
|
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
run_account(tddium)
|
505
|
-
end
|
506
|
-
end
|
507
|
-
|
508
|
-
context "--ssh-key-file is supplied" do
|
509
|
-
it "should not prompt the user for their ssh key file" do
|
510
|
-
tddium.should_not_receive(:ask).with(Tddium::Text::Prompt::SSH_KEY % Tddium::Default::SSH_FILE)
|
511
|
-
run_account(tddium, :ssh_key_file => Tddium::Default::SSH_FILE)
|
512
|
-
end
|
494
|
+
context "--ssh-key-file is supplied" do
|
495
|
+
it "should not prompt the user for their ssh key file" do
|
496
|
+
tddium.should_not_receive(:ask).with(Tddium::Text::Prompt::SSH_KEY % Tddium::Default::SSH_FILE)
|
497
|
+
run(tddium, :ssh_key_file => Tddium::Default::SSH_FILE)
|
513
498
|
end
|
514
499
|
end
|
500
|
+
end
|
515
501
|
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
tddium.stub(:
|
520
|
-
|
521
|
-
|
502
|
+
describe "#heroku" do
|
503
|
+
before do
|
504
|
+
stub_defaults
|
505
|
+
tddium.stub(:ask).and_return("")
|
506
|
+
HighLine.stub(:ask).and_return("")
|
507
|
+
create_file(File.join(File.dirname(__FILE__), "..", Tddium::License::FILE_NAME), SAMPLE_LICENSE_TEXT)
|
508
|
+
create_file(Tddium::Default::SSH_FILE, SAMPLE_SSH_PUBKEY)
|
509
|
+
HerokuConfig.stub(:read_config).and_raise(HerokuConfig::HerokuNotFound)
|
522
510
|
end
|
523
511
|
|
524
512
|
context "the user is logged in to heroku, but not to tddium" do
|
@@ -547,7 +535,7 @@ describe Tddium do
|
|
547
535
|
|
548
536
|
it "should display the heroku welcome" do
|
549
537
|
tddium.should_receive(:say).with(Tddium::Text::Process::HEROKU_WELCOME % SAMPLE_EMAIL)
|
550
|
-
|
538
|
+
run_heroku(tddium)
|
551
539
|
end
|
552
540
|
|
553
541
|
it "should send a 'PUT' request to user_path with passwords" do
|
@@ -561,7 +549,7 @@ describe Tddium do
|
|
561
549
|
:user_git_pubkey => SAMPLE_SSH_PUBKEY},
|
562
550
|
:heroku_activation => true},
|
563
551
|
:api_key => SAMPLE_API_KEY)
|
564
|
-
|
552
|
+
heroku_should_fail(tddium) # call_api_should_receive stubs call_api with an error
|
565
553
|
end
|
566
554
|
|
567
555
|
context "PUT with passwords is successful" do
|
@@ -573,7 +561,7 @@ describe Tddium do
|
|
573
561
|
|
574
562
|
it "should display the heroku configured welcome" do
|
575
563
|
tddium.should_receive(:say).with(Tddium::Text::Status::HEROKU_CONFIG)
|
576
|
-
|
564
|
+
run_heroku(tddium)
|
577
565
|
end
|
578
566
|
end
|
579
567
|
|
@@ -583,7 +571,7 @@ describe Tddium do
|
|
583
571
|
end
|
584
572
|
|
585
573
|
it "should display an error message and fail" do
|
586
|
-
|
574
|
+
heroku_should_fail(tddium) do
|
587
575
|
tddium.should_receive(:exit_failure).with(Tddium::Text::Error::HEROKU_MISCONFIGURED % "200 OK (1) PUT error")
|
588
576
|
end
|
589
577
|
end
|
@@ -597,7 +585,7 @@ describe Tddium do
|
|
597
585
|
|
598
586
|
it "should display the heroku configured welcome" do
|
599
587
|
tddium.should_receive(:say).with(Tddium::Text::Status::HEROKU_CONFIG)
|
600
|
-
|
588
|
+
run_heroku(tddium)
|
601
589
|
end
|
602
590
|
end
|
603
591
|
end
|
@@ -606,12 +594,49 @@ describe Tddium do
|
|
606
594
|
let(:call_api_result) {[403, "Forbidden"]}
|
607
595
|
|
608
596
|
it "should display an error message and fail" do
|
609
|
-
|
597
|
+
heroku_should_fail(tddium) do
|
610
598
|
tddium.should_receive(:exit_failure).with(Tddium::Text::Error::HEROKU_MISCONFIGURED % "Unrecognized user")
|
611
599
|
end
|
612
600
|
end
|
613
601
|
end
|
614
602
|
end
|
603
|
+
end
|
604
|
+
|
605
|
+
|
606
|
+
describe "#account" do
|
607
|
+
before do
|
608
|
+
stub_defaults
|
609
|
+
tddium.stub(:ask).and_return("")
|
610
|
+
HighLine.stub(:ask).and_return("")
|
611
|
+
create_file(File.join(File.dirname(__FILE__), "..", Tddium::License::FILE_NAME), SAMPLE_LICENSE_TEXT)
|
612
|
+
create_file(Tddium::Default::SSH_FILE, SAMPLE_SSH_PUBKEY)
|
613
|
+
HerokuConfig.stub(:read_config).and_return(nil)
|
614
|
+
end
|
615
|
+
|
616
|
+
it_should_behave_like "set the default environment"
|
617
|
+
|
618
|
+
context "the user is already logged in" do
|
619
|
+
before do
|
620
|
+
stub_config_file(:api_key => SAMPLE_API_KEY)
|
621
|
+
stub_call_api_response(:get, Tddium::Api::Path::USERS, SAMPLE_USER_RESPONSE)
|
622
|
+
end
|
623
|
+
|
624
|
+
it "should show the user's email address" do
|
625
|
+
tddium.should_receive(:say).with(/#{SAMPLE_EMAIL}/)
|
626
|
+
run_account(tddium)
|
627
|
+
end
|
628
|
+
|
629
|
+
it "should show the user's account creation date" do
|
630
|
+
tddium.should_receive(:say).with(/#{SAMPLE_DATE_TIME}/)
|
631
|
+
run_account(tddium)
|
632
|
+
end
|
633
|
+
|
634
|
+
it "should show the user's recurly account url" do
|
635
|
+
tddium.should_receive(:say).with(/#{SAMPLE_RECURLY_URL}/)
|
636
|
+
run_account(tddium)
|
637
|
+
end
|
638
|
+
|
639
|
+
end
|
615
640
|
|
616
641
|
context "the user is not already logged in" do
|
617
642
|
let(:call_api_result) {[403, "Forbidden"]}
|
@@ -797,29 +822,11 @@ describe Tddium do
|
|
797
822
|
it_should_behave_like ".tddium file is missing or corrupt"
|
798
823
|
it_should_behave_like "suite has not been initialized"
|
799
824
|
|
800
|
-
def spec_should_fail(options={})
|
801
|
-
options[:test_pattern] = DEFAULT_TEST_PATTERN unless options.has_key?(:test_pattern)
|
802
|
-
options[:environment] = "test" unless options.has_key?(:environment)
|
803
|
-
stub_cli_options(tddium, options)
|
804
|
-
tddium.stub(:exit_failure).and_raise(SystemExit)
|
805
|
-
yield if block_given?
|
806
|
-
expect { tddium.spec }.to raise_error(SystemExit)
|
807
|
-
end
|
808
|
-
|
809
|
-
def spec_should_pass(options={})
|
810
|
-
options[:test_pattern] = DEFAULT_TEST_PATTERN unless options.has_key?(:test_pattern)
|
811
|
-
options[:environment] = "test" unless options.has_key?(:environment)
|
812
|
-
stub_cli_options(tddium, options)
|
813
|
-
tddium.stub(:exit_failure).and_raise(SystemExit)
|
814
|
-
yield if block_given?
|
815
|
-
expect { tddium.spec }.not_to raise_error
|
816
|
-
end
|
817
|
-
|
818
825
|
context "user-data-file" do
|
819
826
|
context "does not exist" do
|
820
827
|
context "from command line option" do
|
821
828
|
it "should be picked first" do
|
822
|
-
spec_should_fail(:user_data_file => SAMPLE_FILE_PATH) do
|
829
|
+
spec_should_fail(tddium, :user_data_file => SAMPLE_FILE_PATH) do
|
823
830
|
tddium.should_receive(:exit_failure).with(Tddium::Text::Error::NO_USER_DATA_FILE % SAMPLE_FILE_PATH)
|
824
831
|
end
|
825
832
|
end
|
@@ -829,7 +836,7 @@ describe Tddium do
|
|
829
836
|
before { stub_config_file(:branches => {SAMPLE_BRANCH_NAME => {"id" => SAMPLE_SUITE_ID, "options" => {"user_data_file" => SAMPLE_FILE_PATH2}}}) }
|
830
837
|
|
831
838
|
it "should be picked if no command line option" do
|
832
|
-
spec_should_fail do
|
839
|
+
spec_should_fail(tddium) do
|
833
840
|
tddium.should_receive(:exit_failure).with(Tddium::Text::Error::NO_USER_DATA_FILE % SAMPLE_FILE_PATH2)
|
834
841
|
end
|
835
842
|
end
|
@@ -837,12 +844,12 @@ describe Tddium do
|
|
837
844
|
|
838
845
|
it "should not try to git push" do
|
839
846
|
tddium.should_not_receive(:system).with(/^git push/)
|
840
|
-
spec_should_fail(:user_data_file => SAMPLE_FILE_PATH)
|
847
|
+
spec_should_fail(tddium, :user_data_file => SAMPLE_FILE_PATH)
|
841
848
|
end
|
842
849
|
|
843
850
|
it "should not call the api" do
|
844
851
|
tddium_client.should_not_receive(:call_api)
|
845
|
-
spec_should_fail(:user_data_file => SAMPLE_FILE_PATH)
|
852
|
+
spec_should_fail(tddium, :user_data_file => SAMPLE_FILE_PATH)
|
846
853
|
end
|
847
854
|
end
|
848
855
|
end
|
@@ -880,12 +887,12 @@ describe Tddium do
|
|
880
887
|
|
881
888
|
it "should fail on an API error" do
|
882
889
|
stub_call_api_error(:post, Tddium::Api::Path::SESSIONS, 403, "Access Denied")
|
883
|
-
spec_should_fail
|
890
|
+
spec_should_fail(tddium)
|
884
891
|
end
|
885
892
|
|
886
893
|
it "should fail on any other error" do
|
887
894
|
tddium_client.stub(:call_api).with(anything, anything, anything, anything).and_raise("generic runtime error")
|
888
|
-
spec_should_fail
|
895
|
+
spec_should_fail(tddium)
|
889
896
|
end
|
890
897
|
|
891
898
|
context "'POST #{Tddium::Api::Path::SESSIONS}' is successful" do
|
@@ -1075,7 +1082,7 @@ describe Tddium do
|
|
1075
1082
|
|
1076
1083
|
it "should display a summary of all the tests" do
|
1077
1084
|
tddium.should_receive(:say).with("4 tests, 1 failures, 1 errors, 1 pending")
|
1078
|
-
spec_should_fail do
|
1085
|
+
spec_should_fail(tddium) do
|
1079
1086
|
tddium.should_receive(:exit_failure).once
|
1080
1087
|
end
|
1081
1088
|
end
|
@@ -1096,7 +1103,7 @@ describe Tddium do
|
|
1096
1103
|
end
|
1097
1104
|
it "should display a summary of all the tests and exit failure" do
|
1098
1105
|
tddium.should_receive(:say).with("4 tests, 0 failures, 4 errors, 0 pending")
|
1099
|
-
spec_should_fail do
|
1106
|
+
spec_should_fail(tddium) do
|
1100
1107
|
tddium.should_receive(:exit_failure).once
|
1101
1108
|
end
|
1102
1109
|
end
|
@@ -1136,7 +1143,7 @@ describe Tddium do
|
|
1136
1143
|
|
1137
1144
|
it "should display a summary of all the tests" do
|
1138
1145
|
tddium.should_receive(:say).with("4 tests, 0 failures, 0 errors, 0 pending")
|
1139
|
-
spec_should_pass do
|
1146
|
+
spec_should_pass(tddium) do
|
1140
1147
|
tddium.should_not_receive(:exit_failure)
|
1141
1148
|
end
|
1142
1149
|
end
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tddium-preview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
- 6
|
10
|
+
version: 0.5.6
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Solano Labs
|
@@ -21,6 +26,9 @@ dependencies:
|
|
21
26
|
requirements:
|
22
27
|
- - ">="
|
23
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
24
32
|
version: "0"
|
25
33
|
type: :runtime
|
26
34
|
version_requirements: *id001
|
@@ -32,6 +40,9 @@ dependencies:
|
|
32
40
|
requirements:
|
33
41
|
- - ">="
|
34
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
35
46
|
version: "0"
|
36
47
|
type: :runtime
|
37
48
|
version_requirements: *id002
|
@@ -43,6 +54,9 @@ dependencies:
|
|
43
54
|
requirements:
|
44
55
|
- - ">="
|
45
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
46
60
|
version: "0"
|
47
61
|
type: :runtime
|
48
62
|
version_requirements: *id003
|
@@ -54,6 +68,11 @@ dependencies:
|
|
54
68
|
requirements:
|
55
69
|
- - ">="
|
56
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 19
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
- 0
|
75
|
+
- 6
|
57
76
|
version: 0.0.6
|
58
77
|
type: :runtime
|
59
78
|
version_requirements: *id004
|
@@ -65,6 +84,9 @@ dependencies:
|
|
65
84
|
requirements:
|
66
85
|
- - ">="
|
67
86
|
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
68
90
|
version: "0"
|
69
91
|
type: :runtime
|
70
92
|
version_requirements: *id005
|
@@ -76,6 +98,9 @@ dependencies:
|
|
76
98
|
requirements:
|
77
99
|
- - ">="
|
78
100
|
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
79
104
|
version: "0"
|
80
105
|
type: :development
|
81
106
|
version_requirements: *id006
|
@@ -87,6 +112,9 @@ dependencies:
|
|
87
112
|
requirements:
|
88
113
|
- - ">="
|
89
114
|
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
116
|
+
segments:
|
117
|
+
- 0
|
90
118
|
version: "0"
|
91
119
|
type: :development
|
92
120
|
version_requirements: *id007
|
@@ -98,6 +126,9 @@ dependencies:
|
|
98
126
|
requirements:
|
99
127
|
- - ">="
|
100
128
|
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
130
|
+
segments:
|
131
|
+
- 0
|
101
132
|
version: "0"
|
102
133
|
type: :development
|
103
134
|
version_requirements: *id008
|
@@ -109,6 +140,9 @@ dependencies:
|
|
109
140
|
requirements:
|
110
141
|
- - ">="
|
111
142
|
- !ruby/object:Gem::Version
|
143
|
+
hash: 3
|
144
|
+
segments:
|
145
|
+
- 0
|
112
146
|
version: "0"
|
113
147
|
type: :development
|
114
148
|
version_requirements: *id009
|
@@ -158,12 +192,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
192
|
requirements:
|
159
193
|
- - ">="
|
160
194
|
- !ruby/object:Gem::Version
|
195
|
+
hash: 3
|
196
|
+
segments:
|
197
|
+
- 0
|
161
198
|
version: "0"
|
162
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
163
200
|
none: false
|
164
201
|
requirements:
|
165
202
|
- - ">="
|
166
203
|
- !ruby/object:Gem::Version
|
204
|
+
hash: 3
|
205
|
+
segments:
|
206
|
+
- 0
|
167
207
|
version: "0"
|
168
208
|
requirements: []
|
169
209
|
|