tddium-preview 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/lib/tddium/constant.rb +7 -5
- data/lib/tddium/version.rb +1 -1
- data/lib/tddium.rb +28 -16
- data/spec/tddium_spec.rb +5 -5
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/lib/tddium/constant.rb
CHANGED
@@ -56,13 +56,14 @@ module TddiumConstant
|
|
56
56
|
NEW_PASSWORD = "Enter a new password: "
|
57
57
|
PASSWORD_CONFIRMATION = "Confirm your password: "
|
58
58
|
INVITATION_TOKEN = "Enter your invitation token:"
|
59
|
-
USE_EXISTING_SUITE = "
|
59
|
+
USE_EXISTING_SUITE = "A suite exists '%%s' (branch %s). Enter '#{Response::YES}' to use it, or enter a new repo name:"
|
60
60
|
end
|
61
61
|
|
62
62
|
module Process
|
63
63
|
TERMINATE_INSTRUCTION = "Press Ctrl-C to stop waiting. Tests will continue running."
|
64
64
|
INTERRUPT = "Interrupted"
|
65
|
-
|
65
|
+
GIT_PUSH = "Pushing changes to Tddium..."
|
66
|
+
STARTING_TEST = "Startng %s tests..."
|
66
67
|
CHECK_TEST_STATUS = "Use 'tddium status' to check on pending jobs"
|
67
68
|
FINISHED_TEST = "Finished in %s seconds"
|
68
69
|
CHECK_TEST_REPORT = "Test report: %s"
|
@@ -88,9 +89,10 @@ tddium spec
|
|
88
89
|
ALREADY_LOGGED_IN = "You're already logged in"
|
89
90
|
LOGGED_IN_SUCCESSFULLY = "Logged in successfully"
|
90
91
|
LOGGED_OUT_SUCCESSFULLY = "Logged out successfully"
|
91
|
-
|
92
|
-
|
93
|
-
|
92
|
+
USING_SPEC_OPTION = {:max_parallelism => "Max number of tests in parallel = %s",
|
93
|
+
:user_data_file => "Sending user data from %s",
|
94
|
+
:test_pattern => "Selecting tests that match '%s'"}
|
95
|
+
REMEMBERED = " (Remembered value)"
|
94
96
|
HEROKU_WELCOME = "
|
95
97
|
Thanks for installing the Tddium Heroku Add-On!
|
96
98
|
|
data/lib/tddium/version.rb
CHANGED
data/lib/tddium.rb
CHANGED
@@ -134,10 +134,7 @@ class Tddium < Thor
|
|
134
134
|
|
135
135
|
test_execution_params = {}
|
136
136
|
|
137
|
-
|
138
|
-
if user_data_file_path = options[:user_data_file] || current_suite_options["user_data_file"]
|
139
|
-
say Text::Process::USING_PREVIOUS_USER_DATA_FILE % user_data_file_path if user_data_file_path == current_suite_options["user_data_file"]
|
140
|
-
|
137
|
+
user_data_file_path = get_remembered_option(options, :user_data_file, nil) do |user_data_file_path|
|
141
138
|
if File.exists?(user_data_file_path)
|
142
139
|
user_data = File.open(user_data_file_path) { |file| file.read }
|
143
140
|
test_execution_params[:user_data_text] = Base64.encode64(user_data)
|
@@ -147,19 +144,11 @@ class Tddium < Thor
|
|
147
144
|
end
|
148
145
|
end
|
149
146
|
|
150
|
-
|
151
|
-
if max_parallelism = options[:max_parallelism] || current_suite_options["max_parallelism"]
|
152
|
-
say Text::Process::USING_PREVIOUS_MAX_PARALLELISM % max_parallelism if max_parallelism == current_suite_options["max_parallelism"]
|
147
|
+
max_parallelism = get_remembered_option(options, :max_parallelism, nil) do |max_parallelism|
|
153
148
|
test_execution_params[:max_parallelism] = max_parallelism
|
154
149
|
end
|
155
150
|
|
156
|
-
|
157
|
-
if current_suite_options["test_pattern"]
|
158
|
-
test_pattern = current_suite_options["test_pattern"]
|
159
|
-
say Text::Process::USING_PREVIOUS_TEST_PATTERN % test_pattern if options[:test_pattern] == current_suite_options["test_pattern"]
|
160
|
-
else
|
161
|
-
test_pattern = options[:test_pattern]
|
162
|
-
end
|
151
|
+
test_pattern = get_remembered_option(options, :test_pattern, Default::TEST_PATTERN)
|
163
152
|
|
164
153
|
start_time = Time.now
|
165
154
|
|
@@ -184,13 +173,13 @@ class Tddium < Thor
|
|
184
173
|
# Register the tests
|
185
174
|
call_api(:post, "#{Api::Path::SESSIONS}/#{session_id}/#{Api::Path::REGISTER_TEST_EXECUTIONS}", {:suite_id => current_suite_id, :tests => test_files})
|
186
175
|
|
176
|
+
say Text::Process::STARTING_TEST % test_files.size
|
187
177
|
# Start the tests
|
188
178
|
start_test_executions = call_api(:post, "#{Api::Path::SESSIONS}/#{session_id}/#{Api::Path::START_TEST_EXECUTIONS}", test_execution_params)
|
189
179
|
tests_not_finished_yet = true
|
190
180
|
finished_tests = {}
|
191
181
|
test_statuses = Hash.new(0)
|
192
182
|
|
193
|
-
say Text::Process::STARTING_TEST % test_files.size
|
194
183
|
say Text::Process::CHECK_TEST_REPORT % start_test_executions["report"]
|
195
184
|
say Text::Process::TERMINATE_INSTRUCTION
|
196
185
|
while tests_not_finished_yet do
|
@@ -305,7 +294,7 @@ class Tddium < Thor
|
|
305
294
|
current_suite_name = params[:repo_name]
|
306
295
|
if existing_suite
|
307
296
|
# Prompt for using existing suite (unless suite name is passed from command line) or entering new one
|
308
|
-
params[:repo_name] = prompt(Text::Prompt::USE_EXISTING_SUITE, options[:name], current_suite_name)
|
297
|
+
params[:repo_name] = prompt(Text::Prompt::USE_EXISTING_SUITE % params[:branch], options[:name], current_suite_name)
|
309
298
|
if options[:name] || params[:repo_name] == Text::Prompt::Response::YES
|
310
299
|
# Use the existing suite, so assign the value back and exit the loop
|
311
300
|
params[:repo_name] = current_suite_name
|
@@ -396,6 +385,28 @@ class Tddium < Thor
|
|
396
385
|
abort msg
|
397
386
|
end
|
398
387
|
|
388
|
+
def get_remembered_option(options, key, default, &block)
|
389
|
+
remembered = false
|
390
|
+
if options[key] != default
|
391
|
+
result = options[key]
|
392
|
+
elsif remembered = current_suite_options[key.to_s]
|
393
|
+
result = remembered
|
394
|
+
remembered = true
|
395
|
+
else
|
396
|
+
result = default
|
397
|
+
end
|
398
|
+
|
399
|
+
if result
|
400
|
+
msg = Text::Process::USING_SPEC_OPTION[key] % result
|
401
|
+
msg += Text::Process::REMEMBERED if remembered
|
402
|
+
msg += "\n"
|
403
|
+
say msg
|
404
|
+
yield result if block_given?
|
405
|
+
end
|
406
|
+
result
|
407
|
+
end
|
408
|
+
|
409
|
+
|
399
410
|
def get_user
|
400
411
|
call_api(:get, Api::Path::USERS, {}, nil, false) rescue nil
|
401
412
|
end
|
@@ -413,6 +424,7 @@ class Tddium < Thor
|
|
413
424
|
end
|
414
425
|
|
415
426
|
def git_push
|
427
|
+
say Text::Process::GIT_PUSH
|
416
428
|
system("git push -f #{Git::REMOTE_NAME} #{current_git_branch}")
|
417
429
|
end
|
418
430
|
|
data/spec/tddium_spec.rb
CHANGED
@@ -1334,7 +1334,7 @@ describe Tddium do
|
|
1334
1334
|
context "but this user has already registered some suites" do
|
1335
1335
|
before do
|
1336
1336
|
stub_call_api_response(:get, Tddium::Api::Path::SUITES, SAMPLE_SUITES_RESPONSE, {"suites" => []})
|
1337
|
-
tddium.stub(:ask).with(Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_APP_NAME).and_return(Tddium::Text::Prompt::Response::YES)
|
1337
|
+
tddium.stub(:ask).with(Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_BRANCH_NAME % SAMPLE_APP_NAME).and_return(Tddium::Text::Prompt::Response::YES)
|
1338
1338
|
end
|
1339
1339
|
|
1340
1340
|
shared_examples_for "writing the suite to file" do
|
@@ -1360,8 +1360,8 @@ describe Tddium do
|
|
1360
1360
|
end
|
1361
1361
|
|
1362
1362
|
context "passing no cli options" do
|
1363
|
-
it "should ask the user: '#{Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_APP_NAME}' " do
|
1364
|
-
tddium.should_receive(:ask).with(Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_APP_NAME).and_return("something")
|
1363
|
+
it "should ask the user: '#{Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_BRANCH_NAME % SAMPLE_APP_NAME}' " do
|
1364
|
+
tddium.should_receive(:ask).with(Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_BRANCH_NAME % SAMPLE_APP_NAME).and_return("something")
|
1365
1365
|
run_suite(tddium)
|
1366
1366
|
end
|
1367
1367
|
end
|
@@ -1404,7 +1404,7 @@ describe Tddium do
|
|
1404
1404
|
end
|
1405
1405
|
|
1406
1406
|
context "the user does not want to use the existing suite" do
|
1407
|
-
before{ tddium.stub(:ask).with(Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_APP_NAME).and_return("some_other_suite") }
|
1407
|
+
before{ tddium.stub(:ask).with(Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_BRANCH_NAME % SAMPLE_APP_NAME).and_return("some_other_suite") }
|
1408
1408
|
|
1409
1409
|
|
1410
1410
|
it "should send a 'POST' request to '#{Tddium::Api::Path::SUITES}'" do
|
@@ -1438,7 +1438,7 @@ describe Tddium do
|
|
1438
1438
|
|
1439
1439
|
context "interactive mode" do
|
1440
1440
|
before do
|
1441
|
-
tddium.stub(:ask).with(Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_APP_NAME).and_return("foobar")
|
1441
|
+
tddium.stub(:ask).with(Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_BRANCH_NAME % SAMPLE_APP_NAME).and_return("foobar")
|
1442
1442
|
stub_default_suite_name
|
1443
1443
|
end
|
1444
1444
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: tddium-preview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Solano Labs
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-06-02 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|