tddium-preview 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tddium-preview (0.1.0)
4
+ tddium-preview (0.1.2)
5
5
  bundler
6
6
  highline
7
7
  json
@@ -48,7 +48,6 @@ module TddiumConstant
48
48
  YES = "y"
49
49
  end
50
50
  SSH_KEY = "Enter your ssh key or press 'Return'. Using '%s' by default:"
51
- TEST_PATTERN = "Enter a test pattern or press 'Return'. Using '%s' by default:"
52
51
  SUITE_NAME = "Enter a suite name or press 'Return'. Using '%s' by default:"
53
52
  LICENSE_AGREEMENT = "Type '%s' to accept the license and continue:" % Response::AGREE_TO_LICENSE
54
53
  EMAIL = "Enter your email address:"
@@ -65,7 +64,8 @@ module TddiumConstant
65
64
  CHECK_TEST_STATUS = "Use 'tddium status' to check on pending jobs"
66
65
  FINISHED_TEST = "Finished in %s seconds"
67
66
  CHECK_TEST_REPORT = "You can check out the test report details at %s"
68
- UPDATE_SUITE = "The suite has been updated successfully"
67
+ EXISTING_SUITE = "Current suite: %s"
68
+ CREATING_SUITE = "Creating suite '%s'. This will take a few seconds."
69
69
  PASSWORD_CONFIRMATION_INCORRECT = "Password confirmation incorrect"
70
70
  ACCOUNT_CREATED = "
71
71
  Congratulations %s, your tddium account has been created!
@@ -3,5 +3,5 @@ Copyright (c) 2011 Solano Labs All Rights Reserved
3
3
  =end
4
4
 
5
5
  module TddiumVersion
6
- VERSION = "0.1.1"
6
+ VERSION = "0.1.2"
7
7
  end
data/lib/tddium.rb CHANGED
@@ -102,7 +102,7 @@ class Tddium < Thor
102
102
  method_option :environment, :type => :string, :default => nil
103
103
  method_option :user_data_file, :type => :string, :default => nil
104
104
  method_option :max_parallelism, :type => :numeric, :default => nil
105
- method_option :test_pattern, :type => :string, :default => "**/*_spec.rb"
105
+ method_option :test_pattern, :type => :string, :default => Default::TEST_PATTERN
106
106
  def spec
107
107
  set_default_environment(options[:environment])
108
108
  return unless git_repo? && tddium_settings && suite_for_current_branch?
@@ -245,7 +245,6 @@ class Tddium < Thor
245
245
  end
246
246
 
247
247
  desc "suite", "Register the suite for this project, or manage its settings"
248
- method_option :test_pattern, :type => :string, :default => nil
249
248
  method_option :name, :type => :string, :default => nil
250
249
  method_option :environment, :type => :string, :default => nil
251
250
  def suite
@@ -255,13 +254,9 @@ class Tddium < Thor
255
254
  params = {}
256
255
  begin
257
256
  if current_suite_id
258
- current_suite = call_api(:get, current_suite_path)
259
- # Get the current test pattern and prompt for updates
260
- params[:test_pattern] = prompt(Text::Prompt::TEST_PATTERN, options[:test_pattern], current_suite["suite"]["test_pattern"])
257
+ current_suite = call_api(:get, current_suite_path)["suite"]
261
258
 
262
- # Update the current suite if it exists already
263
- call_api(:put, current_suite_path, {:suite => params})
264
- say Text::Process::UPDATE_SUITE
259
+ say Text::Process::EXISTING_SUITE % "#{current_suite["repo_name"]}/#{current_suite["branch"]}"
265
260
  else
266
261
  params[:branch] = current_git_branch
267
262
  default_suite_name = File.basename(Dir.pwd)
@@ -307,9 +302,9 @@ class Tddium < Thor
307
302
  params[:bundler_version] = dependency_version(:bundle)
308
303
  params[:rubygems_version] = dependency_version(:gem)
309
304
 
310
- params[:test_pattern] = prompt(Text::Prompt::TEST_PATTERN, options[:test_pattern], Default::TEST_PATTERN)
311
305
 
312
306
  # Create new suite if it does not exist yet
307
+ say Text::Process::CREATING_SUITE % params[:repo_name]
313
308
  new_suite = call_api(:post, Api::Path::SUITES, {:suite => params})
314
309
  # Save the created suite
315
310
  write_suite(new_suite["suite"]["id"])
data/spec/tddium_spec.rb CHANGED
@@ -27,10 +27,9 @@ describe Tddium do
27
27
  SAMPLE_RECURLY_URL = "https://tddium.recurly.com/account/1"
28
28
  SAMPLE_SESSION_ID = 1
29
29
  SAMPLE_SUITE_ID = 1
30
- SAMPLE_TEST_PATTERN = "**/*_spec.rb" # XXX Bogus. Removeme.
31
30
  DEFAULT_TEST_PATTERN = "**/*_spec.rb"
32
31
  CUSTOM_TEST_PATTERN = "**/cat_spec.rb"
33
- SAMPLE_SUITE_RESPONSE = {"repo_name" => SAMPLE_APP_NAME, "branch" => SAMPLE_BRANCH_NAME, "id" => SAMPLE_SUITE_ID, "test_pattern"=>SAMPLE_TEST_PATTERN, "ruby_version"=>SAMPLE_RUBY_VERSION, "git_repo_uri" => SAMPLE_GIT_REPO_URI}
32
+ SAMPLE_SUITE_RESPONSE = {"repo_name" => SAMPLE_APP_NAME, "branch" => SAMPLE_BRANCH_NAME, "id" => SAMPLE_SUITE_ID, "ruby_version"=>SAMPLE_RUBY_VERSION, "git_repo_uri" => SAMPLE_GIT_REPO_URI}
34
33
  SAMPLE_SUITES_RESPONSE = {"suites" => [SAMPLE_SUITE_RESPONSE]}
35
34
  SAMPLE_TDDIUM_CONFIG_FILE = ".tddium.test"
36
35
  SAMPLE_TEST_EXECUTION_STATS = "total 1, notstarted 0, started 1, passed 0, failed 0, pending 0, error 0", "start_time"
@@ -856,7 +855,7 @@ describe Tddium do
856
855
  end
857
856
 
858
857
  context "and returns some suites" do
859
- let(:suite_attributes) { {"id"=>SAMPLE_SUITE_ID, "repo_name"=>SAMPLE_APP_NAME, "ruby_version"=>SAMPLE_RUBY_VERSION, "branch" => SAMPLE_BRANCH_NAME, "test_pattern" => SAMPLE_TEST_PATTERN, "bundler_version" => SAMPLE_BUNDLER_VERSION, "rubygems_version" => SAMPLE_RUBYGEMS_VERSION}}
858
+ let(:suite_attributes) { {"id"=>SAMPLE_SUITE_ID, "repo_name"=>SAMPLE_APP_NAME, "ruby_version"=>SAMPLE_RUBY_VERSION, "branch" => SAMPLE_BRANCH_NAME, "bundler_version" => SAMPLE_BUNDLER_VERSION, "rubygems_version" => SAMPLE_RUBYGEMS_VERSION}}
860
859
  before do
861
860
  stub_call_api_response(:get, Tddium::Api::Path::SUITES, {"suites"=>[suite_attributes]})
862
861
  end
@@ -1023,10 +1022,10 @@ describe Tddium do
1023
1022
  end
1024
1023
  end
1025
1024
 
1026
- context "passing '--name=my_suite --test-pattern=**/*_selenium.rb'" do
1025
+ context "passing '--name=my_suite'" do
1027
1026
  it "should POST request with the passed in values to the API" do
1028
- call_api_should_receive(:method => :post, :path => Tddium::Api::Path::SUITES, :params => {:suite => hash_including(:repo_name => "my_suite", :test_pattern => "**/*_selenium.rb")})
1029
- run_suite(tddium, :name => "my_suite", :test_pattern => "**/*_selenium.rb")
1027
+ call_api_should_receive(:method => :post, :path => Tddium::Api::Path::SUITES, :params => {:suite => hash_including(:repo_name => "my_suite")})
1028
+ run_suite(tddium, :name => "my_suite")
1030
1029
  end
1031
1030
  end
1032
1031
 
@@ -1098,10 +1097,6 @@ describe Tddium do
1098
1097
  context "the user does not want to use the existing suite" do
1099
1098
  before{ tddium.stub(:ask).with(Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_APP_NAME).and_return("some_other_suite") }
1100
1099
 
1101
- it "should ask for a test file pattern" do
1102
- tddium.should_receive(:ask).with(Tddium::Text::Prompt::TEST_PATTERN % Tddium::Default::TEST_PATTERN)
1103
- run_suite(tddium)
1104
- end
1105
1100
 
1106
1101
  it "should send a 'POST' request to '#{Tddium::Api::Path::SUITES}'" do
1107
1102
  call_api_should_receive(:method => :post, :path => Tddium::Api::Path::SUITES)
@@ -1132,22 +1127,15 @@ describe Tddium do
1132
1127
  run_suite(tddium)
1133
1128
  end
1134
1129
 
1135
- context "using defaults" do
1136
- it "should POST the default test pattern to the API" do
1137
- call_api_should_receive(:params => {:suite => hash_including(:test_pattern => SAMPLE_TEST_PATTERN)})
1138
- run_suite(tddium)
1139
- end
1140
- end
1141
-
1142
1130
  context "interactive mode" do
1143
1131
  before do
1144
1132
  tddium.stub(:ask).with(Tddium::Text::Prompt::USE_EXISTING_SUITE % SAMPLE_APP_NAME).and_return("foobar")
1145
- tddium.stub(:ask).with(Tddium::Text::Prompt::TEST_PATTERN % Tddium::Default::TEST_PATTERN).and_return("**/*_test")
1146
1133
  stub_default_suite_name
1147
1134
  end
1148
1135
 
1149
1136
  it "should POST the user's entered values to the API" do
1150
- call_api_should_receive(:method => :post, :params => {:suite => hash_including(:repo_name => "foobar", :test_pattern => "**/*_test")})
1137
+ tddium.should_receive(:say).with(Tddium::Text::Process::CREATING_SUITE % "foobar")
1138
+ call_api_should_receive(:method => :post, :params => {:suite => hash_including(:repo_name => "foobar")})
1151
1139
  run_suite(tddium)
1152
1140
  end
1153
1141
  end
@@ -1173,11 +1161,12 @@ describe Tddium do
1173
1161
  end
1174
1162
 
1175
1163
  context "'GET #{Tddium::Api::Path::SUITES}/#{SAMPLE_SUITE_ID}' is successful" do
1176
- before do
1164
+ before(:each) do
1177
1165
  response = {
1178
1166
  "suite" => {
1179
- "test_pattern" => "**/*_test.rb",
1180
- "id" => SAMPLE_SUITE_ID
1167
+ "id" => SAMPLE_SUITE_ID,
1168
+ "repo_name" => SAMPLE_APP_NAME,
1169
+ "branch" => SAMPLE_BRANCH_NAME
1181
1170
  }
1182
1171
  }
1183
1172
  stub_call_api_response(:get, "#{Tddium::Api::Path::SUITES}/#{SAMPLE_SUITE_ID}", response)
@@ -1194,24 +1183,11 @@ describe Tddium do
1194
1183
  run_suite(tddium)
1195
1184
  end
1196
1185
 
1197
- it "should prompt for a test pattern using the current test pattern as the default" do
1198
- tddium.should_receive(:ask).with(/\*\*\/\*\_test\.rb/)
1186
+ it "should display '#{Tddium::Text::Process::EXISTING_SUITE}'" do
1187
+ tddium.should_receive(:say).with(Tddium::Text::Process::EXISTING_SUITE % "#{SAMPLE_APP_NAME}/#{SAMPLE_BRANCH_NAME}")
1199
1188
  run_suite(tddium)
1200
1189
  end
1201
1190
 
1202
- it "should send a 'PUT' request to '#{Tddium::Api::Path::SUITES}/#{SAMPLE_SUITE_ID}'" do
1203
- call_api_should_receive(:method => :put, :path => "#{Tddium::Api::Path::SUITES}/#{SAMPLE_SUITE_ID}")
1204
- run_suite(tddium)
1205
- end
1206
-
1207
- context "'PUT #{Tddium::Api::Path::SUITES}/#{SAMPLE_SUITE_ID}' is successful" do
1208
- before { stub_call_api_response(:put, "#{Tddium::Api::Path::SUITES}/#{SAMPLE_SUITE_ID}", {}) }
1209
- it "should display '#{Tddium::Text::Process::UPDATE_SUITE}'" do
1210
- tddium.should_receive(:say).with(Tddium::Text::Process::UPDATE_SUITE)
1211
- run_suite(tddium)
1212
- end
1213
- end
1214
-
1215
1191
  it_should_behave_like "sending the api key"
1216
1192
  it_should_behave_like "an unsuccessful api call"
1217
1193
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: tddium-preview
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.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-04-29 00:00:00 -04:00
13
+ date: 2011-05-01 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency