tddium-preview 0.7.3 → 0.7.4
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 +28 -23
- data/features/login_command.feature +40 -0
- data/features/logout_command.feature +16 -0
- data/features/step_definitions/aruba_steps.rb +4 -0
- data/features/step_definitions/login_steps.rb +18 -0
- data/features/step_definitions/mimic_steps.rb +5 -6
- data/features/step_definitions/suite_steps.rb +43 -0
- data/features/suite_command.feature +24 -0
- data/features/support/aruba.rb +6 -0
- data/features/support/constants.rb +63 -0
- data/features/support/mimic.rb +35 -28
- data/lib/tddium.rb +29 -23
- data/lib/tddium/version.rb +1 -1
- data/spec/tddium_spec.rb +12 -26
- data/tddium.gemspec +1 -1
- metadata +10 -4
- data/features/manage_login.feature +0 -18
data/Gemfile.lock
CHANGED
@@ -5,19 +5,23 @@ PATH
|
|
5
5
|
bundler
|
6
6
|
highline
|
7
7
|
json
|
8
|
-
tddium_client (>= 0.0.
|
8
|
+
tddium_client (>= 0.0.10)
|
9
9
|
tddium_reporting (>= 0.0.3)
|
10
10
|
thor
|
11
11
|
|
12
12
|
GEM
|
13
13
|
remote: http://rubygems.org/
|
14
14
|
specs:
|
15
|
-
aruba (0.
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
aruba (0.4.6)
|
16
|
+
bcat (>= 0.6.1)
|
17
|
+
childprocess (>= 0.2.0)
|
18
|
+
cucumber (>= 1.0.2)
|
19
|
+
rdiscount (>= 1.6.8)
|
20
|
+
rspec (>= 2.6.0)
|
21
|
+
bcat (0.6.1)
|
22
|
+
rack (~> 1.0)
|
19
23
|
builder (3.0.0)
|
20
|
-
childprocess (0.2.
|
24
|
+
childprocess (0.2.2)
|
21
25
|
ffi (~> 1.0.6)
|
22
26
|
crack (0.1.8)
|
23
27
|
cucumber (1.0.2)
|
@@ -27,10 +31,10 @@ GEM
|
|
27
31
|
json (>= 1.4.6)
|
28
32
|
term-ansicolor (>= 1.0.5)
|
29
33
|
daemons (1.1.4)
|
30
|
-
diff-lcs (1.1.
|
31
|
-
fakefs (0.3.
|
34
|
+
diff-lcs (1.1.3)
|
35
|
+
fakefs (0.3.2)
|
32
36
|
ffi (1.0.9)
|
33
|
-
gherkin (2.4.
|
37
|
+
gherkin (2.4.16)
|
34
38
|
json (>= 1.4.6)
|
35
39
|
highline (1.6.2)
|
36
40
|
httparty (0.7.8)
|
@@ -45,29 +49,30 @@ GEM
|
|
45
49
|
cucumber (>= 0.8)
|
46
50
|
rake
|
47
51
|
plist (3.1.0)
|
48
|
-
rack (1.3.
|
49
|
-
rake (0.
|
50
|
-
|
51
|
-
|
52
|
-
rspec-
|
53
|
-
rspec-
|
54
|
-
|
55
|
-
rspec-
|
52
|
+
rack (1.3.2)
|
53
|
+
rake (0.9.2)
|
54
|
+
rdiscount (1.6.8)
|
55
|
+
rspec (2.6.0)
|
56
|
+
rspec-core (~> 2.6.0)
|
57
|
+
rspec-expectations (~> 2.6.0)
|
58
|
+
rspec-mocks (~> 2.6.0)
|
59
|
+
rspec-core (2.6.4)
|
60
|
+
rspec-expectations (2.6.0)
|
56
61
|
diff-lcs (~> 1.1.2)
|
57
|
-
rspec-mocks (2.
|
58
|
-
simplecov (0.4.
|
59
|
-
simplecov-html (~> 0.4.
|
60
|
-
simplecov-html (0.4.
|
62
|
+
rspec-mocks (2.6.0)
|
63
|
+
simplecov (0.4.2)
|
64
|
+
simplecov-html (~> 0.4.4)
|
65
|
+
simplecov-html (0.4.5)
|
61
66
|
sinatra (1.2.6)
|
62
67
|
rack (~> 1.1)
|
63
68
|
tilt (< 2.0, >= 1.2.2)
|
64
|
-
tddium_client (0.0.
|
69
|
+
tddium_client (0.0.10)
|
65
70
|
httparty
|
66
71
|
json
|
67
72
|
tddium_reporting (0.0.3)
|
68
73
|
term-ansicolor (1.0.6)
|
69
74
|
thor (0.14.6)
|
70
|
-
tilt (1.3.
|
75
|
+
tilt (1.3.3)
|
71
76
|
|
72
77
|
PLATFORMS
|
73
78
|
ruby
|
@@ -0,0 +1,40 @@
|
|
1
|
+
@mimic
|
2
|
+
Feature: Login command
|
3
|
+
|
4
|
+
Scenario: Interactively log in successfully
|
5
|
+
Given the user can log in and gets API key "apikey"
|
6
|
+
When I run `tddium login --environment=mimic` interactively
|
7
|
+
And I type "foo@example.com"
|
8
|
+
And I type "barbarbar"
|
9
|
+
And the console session ends
|
10
|
+
Then the output should contain:
|
11
|
+
"""
|
12
|
+
Logged in successfully
|
13
|
+
"""
|
14
|
+
And the exit status should be 0
|
15
|
+
And the file ".tddium.mimic" should contain "apikey"
|
16
|
+
And the file ".gitignore" should contain ".tddium.mimic"
|
17
|
+
And the file ".gitignore" should contain ".tddium-deploy-key.mimic"
|
18
|
+
|
19
|
+
Scenario: Non-interactively log in successfully
|
20
|
+
Given the user can log in and gets API key "apikey"
|
21
|
+
When I run `tddium login --environment=mimic --email=foo@example.com --password=barbarbar`
|
22
|
+
Then the output should contain:
|
23
|
+
"""
|
24
|
+
Logged in successfully
|
25
|
+
"""
|
26
|
+
And the exit status should be 0
|
27
|
+
And the file ".tddium.mimic" should contain "apikey"
|
28
|
+
And the file ".gitignore" should contain ".tddium.mimic"
|
29
|
+
And the file ".gitignore" should contain ".tddium-deploy-key.mimic"
|
30
|
+
|
31
|
+
Scenario: Non-interactively log in unsuccessfully
|
32
|
+
Given the user cannot log in
|
33
|
+
When I run `tddium login --environment=mimic --email=foo@example.com --password=barbarbar`
|
34
|
+
Then the output should contain:
|
35
|
+
"""
|
36
|
+
Access Denied
|
37
|
+
"""
|
38
|
+
And the exit status should be 1
|
39
|
+
And the file ".tddium.mimic" should not exist
|
40
|
+
And the file ".gitignore" should not exist
|
@@ -0,0 +1,16 @@
|
|
1
|
+
@mimic
|
2
|
+
Feature: Logout Command
|
3
|
+
|
4
|
+
Scenario: Logout successfully
|
5
|
+
Given a file named ".tddium.mimic" with:
|
6
|
+
"""
|
7
|
+
{'api_key':'abcdef'}
|
8
|
+
"""
|
9
|
+
When I run `tddium logout --environment=mimic` interactively
|
10
|
+
And the console session ends
|
11
|
+
Then the output should contain:
|
12
|
+
"""
|
13
|
+
Logged out successfully
|
14
|
+
"""
|
15
|
+
And the exit status should be 0
|
16
|
+
And the file ".tddium.mimic" should not exist
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Given /^the user is logged in$/ do
|
2
|
+
@api_key = "abcdef"
|
3
|
+
steps %Q{
|
4
|
+
Given a file named ".tddium.mimic" with:
|
5
|
+
"""
|
6
|
+
{"api_key":"#{@api_key}"}
|
7
|
+
"""
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
Given /^the user can log in and gets API key "([^"]*)"$/ do |apikey|
|
12
|
+
MimicServer.server.install(:post, "/1/users/sign_in", {:status=>0, :api_key=>apikey})
|
13
|
+
end
|
14
|
+
|
15
|
+
Given /^the user cannot log in$/ do
|
16
|
+
MimicServer.server.install(:post, "/1/users/sign_in", {:status=>1, :explanation=>"Access Denied."}, :code=>403)
|
17
|
+
end
|
18
|
+
|
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
@last_exit_status = @interactive.stop
|
1
|
+
When /^I respond to "([^"]*)" with "([^"]*)"$/ do |expect, response|
|
2
|
+
steps %Q{
|
3
|
+
Then the output from "tddium suite --environment=mimic" should contain "#{expect}"
|
4
|
+
When I type "#{response}"
|
5
|
+
}
|
7
6
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
def make_suite_response(name, branch)
|
2
|
+
suite = SAMPLE_SUITE_RESPONSE
|
3
|
+
suite["repo_name"] = name
|
4
|
+
suite["branch"] = branch
|
5
|
+
suite["git_repo_uri"] = "file:///#{Dir.tmpdir}/aruba/repo"
|
6
|
+
suite
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /^the user has a suite for "([^"]*)" on "([^"]*)"$/ do |name, branch|
|
10
|
+
MimicServer.server.install(:get, "/1/suites", {:status=>0, :suites=>[make_suite_response(name, branch)]})
|
11
|
+
end
|
12
|
+
|
13
|
+
Given /^the user has no suites/ do
|
14
|
+
MimicServer.server.install(:get, "/1/suites", {:status=>0, :suites=>[]})
|
15
|
+
end
|
16
|
+
|
17
|
+
Given /^the user can create a suite named "([^"]*)" on branch "([^"]*)"$/ do |name, branch|
|
18
|
+
MimicServer.server.install(:post, "/1/suites", {:status=>0, :suite=>make_suite_response(name, branch)}, :code=>201)
|
19
|
+
end
|
20
|
+
|
21
|
+
Given /^the destination repo exists$/ do
|
22
|
+
steps %Q{
|
23
|
+
Given a directory named "repo"
|
24
|
+
And I cd to "repo"
|
25
|
+
And I successfully run `git init --bare .`
|
26
|
+
And I cd to ".."
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
Given /^a git repo is initialized on branch "([^"]*)"$/ do |branch|
|
31
|
+
steps %Q{
|
32
|
+
Given a directory named "work"
|
33
|
+
And I cd to "work"
|
34
|
+
And I successfully run `git init .`
|
35
|
+
And a file named "testfile" with:
|
36
|
+
"""
|
37
|
+
some data
|
38
|
+
"""
|
39
|
+
And I successfully run `git add .`
|
40
|
+
And I successfully run `git commit -am 'testfile'`
|
41
|
+
And I successfully run `git checkout -b #{branch}`
|
42
|
+
}
|
43
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
@mimic
|
2
|
+
Feature: suite command
|
3
|
+
As a user
|
4
|
+
In order to interact with Tddium
|
5
|
+
I want to configure a test suite
|
6
|
+
|
7
|
+
Scenario: Configure a new suite with a complex branch
|
8
|
+
Given the destination repo exists
|
9
|
+
And a git repo is initialized on branch "test/foobar"
|
10
|
+
And the user is logged in
|
11
|
+
And the user has no suites
|
12
|
+
And the user can create a suite named "beta" on branch "test/foobar"
|
13
|
+
When I run `tddium suite --environment=mimic` interactively
|
14
|
+
And I respond to "repo name" with "beta"
|
15
|
+
Then the output from "tddium suite --environment=mimic" should contain "Detected branch test/foobar"
|
16
|
+
And I respond to "test pattern" with ""
|
17
|
+
And I respond to "URL to pull from" with "disable"
|
18
|
+
And I respond to "URL to push to" with "disable"
|
19
|
+
And I respond to "Campfire subdomain" with "disable"
|
20
|
+
Then the output from "tddium suite --environment=mimic" should contain "Pushing changes to Tddium..."
|
21
|
+
And the output from "tddium suite --environment=mimic" should contain "Created suite..."
|
22
|
+
When the console session ends
|
23
|
+
Then the exit status should be 0
|
24
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'aruba/api'
|
2
|
+
|
3
|
+
SAMPLE_API_KEY = "afb12412bdafe124124asfasfabebafeabwbawf1312342erbfasbb"
|
4
|
+
SAMPLE_APP_NAME = "tddelicious"
|
5
|
+
SAMPLE_BRANCH_NAME = "test"
|
6
|
+
SAMPLE_BUNDLER_VERSION = "Bundler version 1.10.10"
|
7
|
+
SAMPLE_DATE_TIME = "2011-03-11T08:43:02Z"
|
8
|
+
SAMPLE_EMAIL = "someone@example.com"
|
9
|
+
SAMPLE_FILE_PATH = "./my_user_file.png"
|
10
|
+
SAMPLE_FILE_PATH2 = "./my_user_file2.png"
|
11
|
+
SAMPLE_INVITATION_TOKEN = "TZce3NueiXp2lMTmaeRr"
|
12
|
+
SAMPLE_HEROKU_CONFIG = {"TDDIUM_API_KEY" => SAMPLE_API_KEY, "TDDIUM_USER_NAME" => SAMPLE_EMAIL}
|
13
|
+
SAMPLE_LICENSE_TEXT = "LICENSE"
|
14
|
+
SAMPLE_PASSWORD = "foobar"
|
15
|
+
SAMPLE_NEW_PASSWORD = "foobar2"
|
16
|
+
SAMPLE_REPORT_URL = "http://api.tddium.com/1/sessions/1/test_executions/report"
|
17
|
+
SAMPLE_RUBYGEMS_VERSION = "1.3.7"
|
18
|
+
SAMPLE_RUBY_VERSION = "ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10.5.0]"
|
19
|
+
SAMPLE_RECURLY_URL = "https://tddium.recurly.com/account/1"
|
20
|
+
SAMPLE_SESSION_ID = 1
|
21
|
+
SAMPLE_SUITE_ID = 1
|
22
|
+
SAMPLE_USER_ID = 1
|
23
|
+
SAMPLE_ROLE = "member"
|
24
|
+
SAMPLE_ACCOUNT_NAME = "owner@example.com"
|
25
|
+
DEFAULT_TEST_PATTERN = "**/*_spec.rb"
|
26
|
+
SAMPLE_SUITE_PATTERN = "features/*.feature, spec/**/*_spec.rb"
|
27
|
+
CUSTOM_TEST_PATTERN = "**/cat_spec.rb"
|
28
|
+
SAMPLE_SSH_PUBKEY = "ssh-rsa 1234567890"
|
29
|
+
SAMPLE_SUITE_RESPONSE = {"repo_name" => SAMPLE_APP_NAME,
|
30
|
+
"branch" => SAMPLE_BRANCH_NAME,
|
31
|
+
"id" => SAMPLE_SUITE_ID,
|
32
|
+
"ruby_version"=>SAMPLE_RUBY_VERSION,
|
33
|
+
"rubygems_version"=>SAMPLE_RUBYGEMS_VERSION,
|
34
|
+
"bundler_version"=>SAMPLE_BUNDLER_VERSION,
|
35
|
+
"ci_ssh_pubkey" => SAMPLE_SSH_PUBKEY,
|
36
|
+
"test_pattern" => SAMPLE_SUITE_PATTERN}
|
37
|
+
SAMPLE_SUITES_RESPONSE = {"suites" => [SAMPLE_SUITE_RESPONSE]}
|
38
|
+
SAMPLE_TDDIUM_CONFIG_FILE = ".tddium.test"
|
39
|
+
SAMPLE_TDDIUM_DEPLOY_KEY_FILE = ".tddium-deploy-key.test"
|
40
|
+
SAMPLE_TEST_EXECUTION_STATS = "total 1, notstarted 0, started 1, passed 0, failed 0, pending 0, error 0", "start_time"
|
41
|
+
SAMPLE_USER_RESPONSE = {"status"=>0, "user"=>
|
42
|
+
{ "id"=>SAMPLE_USER_ID,
|
43
|
+
"api_key" => SAMPLE_API_KEY,
|
44
|
+
"email" => SAMPLE_EMAIL,
|
45
|
+
"created_at" => SAMPLE_DATE_TIME,
|
46
|
+
"account" => SAMPLE_EMAIL,
|
47
|
+
"recurly_url" => SAMPLE_RECURLY_URL}}
|
48
|
+
SAMPLE_ADDED_USER_RESPONSE = {"status"=>0, "user"=>
|
49
|
+
{ "id"=>SAMPLE_USER_ID,
|
50
|
+
"api_key" => SAMPLE_API_KEY,
|
51
|
+
"email" => SAMPLE_EMAIL,
|
52
|
+
"created_at" => SAMPLE_DATE_TIME,
|
53
|
+
"account" => SAMPLE_ACCOUNT_NAME,
|
54
|
+
"account_role" => SAMPLE_ROLE}}
|
55
|
+
SAMPLE_HEROKU_USER_RESPONSE = {"user"=>
|
56
|
+
{ "id"=>SAMPLE_USER_ID,
|
57
|
+
"api_key" => SAMPLE_API_KEY,
|
58
|
+
"email" => SAMPLE_EMAIL,
|
59
|
+
"created_at" => SAMPLE_DATE_TIME,
|
60
|
+
"heroku_needs_activation" => true,
|
61
|
+
"recurly_url" => SAMPLE_RECURLY_URL}}
|
62
|
+
PASSWORD_ERROR_EXPLANATION = "bad confirmation"
|
63
|
+
PASSWORD_ERROR_RESPONSE = {"status"=>1, "explanation"=> PASSWORD_ERROR_EXPLANATION}
|
data/features/support/mimic.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# Copyright (c) 2011 Solano Labs All Rights Reserved
|
2
|
+
|
1
3
|
require 'mimic'
|
2
4
|
require 'timeout'
|
3
5
|
require 'daemons'
|
@@ -6,32 +8,34 @@ require 'httparty'
|
|
6
8
|
class MimicServer
|
7
9
|
attr_reader :port
|
8
10
|
|
9
|
-
def initialize
|
10
|
-
@port = 8080
|
11
|
-
@
|
12
|
-
|
11
|
+
def initialize(port, log=nil)
|
12
|
+
@port = port || 8080
|
13
|
+
@pid_list = []
|
14
|
+
@log = log
|
13
15
|
end
|
14
16
|
|
15
17
|
def start
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
pid = Kernel.fork
|
19
|
+
if pid.nil? then
|
20
|
+
args = {:fork => false,
|
21
|
+
:host => 'localhost',
|
22
|
+
:port => @port,
|
23
|
+
:remote_configuration_path => '/api'}
|
24
|
+
args[:log] = @log if @log
|
22
25
|
Mimic.mimic(args) do
|
23
|
-
[:INT, :TERM].each { |sig| trap(sig) {
|
26
|
+
[:INT, :TERM].each { |sig| trap(sig) { Kernel.exit!(0) } }
|
24
27
|
end
|
28
|
+
Kernel.exit!(0)
|
25
29
|
end
|
26
|
-
@
|
30
|
+
@pid_list.push(pid)
|
27
31
|
wait
|
28
32
|
end
|
29
33
|
|
30
34
|
def stop
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
@
|
35
|
+
@pid_list.each do |pid|
|
36
|
+
Process.kill("TERM", pid)
|
37
|
+
end
|
38
|
+
@pid_list = []
|
35
39
|
end
|
36
40
|
|
37
41
|
def wait
|
@@ -57,9 +61,10 @@ class MimicServer
|
|
57
61
|
return http
|
58
62
|
end
|
59
63
|
|
60
|
-
def install(verb, path, body,
|
61
|
-
|
62
|
-
|
64
|
+
def install(verb, path, body, options={})
|
65
|
+
api_headers = options.delete(:api_headers)
|
66
|
+
params = { 'path' => path, 'body' => body.to_json }.merge(options)
|
67
|
+
http = call_api(:post, "/api/#{verb}", params.to_json, api_headers)
|
63
68
|
return http
|
64
69
|
end
|
65
70
|
|
@@ -91,9 +96,9 @@ class MimicServer
|
|
91
96
|
mimic.stop
|
92
97
|
end
|
93
98
|
|
94
|
-
def start
|
99
|
+
def start(port=nil, log=nil)
|
95
100
|
return @server if @server
|
96
|
-
@server = MimicServer.new
|
101
|
+
@server = MimicServer.new(port, log || @log)
|
97
102
|
@server.start
|
98
103
|
@server
|
99
104
|
end
|
@@ -105,16 +110,20 @@ class MimicServer
|
|
105
110
|
def clear
|
106
111
|
@server.clear rescue nil
|
107
112
|
end
|
113
|
+
|
114
|
+
def log=(log)
|
115
|
+
@log = log
|
116
|
+
end
|
108
117
|
end
|
109
118
|
end
|
110
119
|
|
111
|
-
|
112
|
-
MimicServer.test
|
113
|
-
end
|
120
|
+
MimicServer.log = STDOUT
|
114
121
|
|
115
122
|
Before('@mimic') do
|
116
|
-
|
117
|
-
|
123
|
+
tid = ENV['TDDIUM_TID'] || 0
|
124
|
+
port = 8500 + tid.to_i
|
125
|
+
ENV['TDDIUM_CLIENT_PORT'] = port.to_s
|
126
|
+
MimicServer.start(port)
|
118
127
|
end
|
119
128
|
|
120
129
|
After('@mimic') do
|
@@ -125,5 +134,3 @@ at_exit do
|
|
125
134
|
server = MimicServer.server
|
126
135
|
server.stop if server
|
127
136
|
end
|
128
|
-
|
129
|
-
MimicServer.start
|
data/lib/tddium.rb
CHANGED
@@ -36,15 +36,17 @@ end
|
|
36
36
|
|
37
37
|
class Tddium < Thor
|
38
38
|
include TddiumConstant
|
39
|
+
|
40
|
+
class_option :environment, :type => :string, :default => nil
|
41
|
+
class_option :port, :type => :numeric, :default => nil
|
39
42
|
|
40
43
|
desc "account", "View/Manage account information"
|
41
|
-
method_option :environment, :type => :string, :default => nil
|
42
44
|
method_option :email, :type => :string, :default => nil
|
43
45
|
method_option :password, :type => :string, :default => nil
|
44
46
|
method_option :ssh_key_file, :type => :string, :default => nil
|
45
47
|
def account
|
46
48
|
set_shell
|
47
|
-
set_default_environment
|
49
|
+
set_default_environment
|
48
50
|
if user_details = user_logged_in?
|
49
51
|
# User is already logged in, so just display the info
|
50
52
|
show_user_details(user_details)
|
@@ -92,14 +94,13 @@ class Tddium < Thor
|
|
92
94
|
end
|
93
95
|
|
94
96
|
desc "heroku", "Connect Heroku account with Tddium"
|
95
|
-
method_option :environment, :type => :string, :default => nil
|
96
97
|
method_option :email, :type => :string, :default => nil
|
97
98
|
method_option :password, :type => :string, :default => nil
|
98
99
|
method_option :ssh_key_file, :type => :string, :default => nil
|
99
100
|
method_option :app, :type => :string, :default => nil
|
100
101
|
def heroku
|
101
102
|
set_shell
|
102
|
-
set_default_environment
|
103
|
+
set_default_environment
|
103
104
|
if user_details = user_logged_in?
|
104
105
|
# User is already logged in, so just display the info
|
105
106
|
show_user_details(user_details)
|
@@ -127,10 +128,9 @@ class Tddium < Thor
|
|
127
128
|
|
128
129
|
desc "password", "Change password"
|
129
130
|
map "passwd" => :password
|
130
|
-
method_option :environment, :type => :string, :default => nil
|
131
131
|
def password
|
132
132
|
set_shell
|
133
|
-
set_default_environment
|
133
|
+
set_default_environment
|
134
134
|
return unless tddium_settings
|
135
135
|
user_details = user_logged_in?
|
136
136
|
return unless user_details
|
@@ -153,37 +153,36 @@ class Tddium < Thor
|
|
153
153
|
end
|
154
154
|
|
155
155
|
desc "login", "Log in to tddium using your email address and password"
|
156
|
-
method_option :environment, :type => :string, :default => nil
|
157
156
|
method_option :email, :type => :string, :default => nil
|
158
157
|
method_option :password, :type => :string, :default => nil
|
159
158
|
def login
|
160
159
|
set_shell
|
161
|
-
set_default_environment
|
160
|
+
set_default_environment
|
162
161
|
if user_logged_in?
|
163
162
|
say Text::Process::ALREADY_LOGGED_IN
|
163
|
+
elsif login_user(:params => get_user_credentials(options), :show_error => true)
|
164
|
+
say Text::Process::LOGGED_IN_SUCCESSFULLY
|
164
165
|
else
|
165
|
-
|
166
|
+
exit_failure
|
166
167
|
end
|
167
168
|
end
|
168
169
|
|
169
170
|
desc "logout", "Log out of tddium"
|
170
|
-
method_option :environment, :type => :string, :default => nil
|
171
171
|
def logout
|
172
172
|
set_shell
|
173
|
-
set_default_environment
|
173
|
+
set_default_environment
|
174
174
|
FileUtils.rm(tddium_file_name) if File.exists?(tddium_file_name)
|
175
175
|
say Text::Process::LOGGED_OUT_SUCCESSFULLY
|
176
176
|
end
|
177
177
|
|
178
178
|
desc "spec", "Run the test suite"
|
179
|
-
method_option :environment, :type => :string, :default => nil
|
180
179
|
method_option :user_data_file, :type => :string, :default => nil
|
181
180
|
method_option :max_parallelism, :type => :numeric, :default => nil
|
182
181
|
method_option :test_pattern, :type => :string, :default => nil
|
183
182
|
method_option :force, :type => :boolean, :default => false
|
184
183
|
def spec
|
185
184
|
set_shell
|
186
|
-
set_default_environment
|
185
|
+
set_default_environment
|
187
186
|
git_version_ok
|
188
187
|
if git_changes then
|
189
188
|
exit_failure(Text::Error::GIT_CHANGES_NOT_COMMITTED) if !options[:force]
|
@@ -293,10 +292,9 @@ class Tddium < Thor
|
|
293
292
|
end
|
294
293
|
|
295
294
|
desc "status", "Display information about this suite, and any open dev sessions"
|
296
|
-
method_option :environment, :type => :string, :default => nil
|
297
295
|
def status
|
298
296
|
set_shell
|
299
|
-
set_default_environment
|
297
|
+
set_default_environment
|
300
298
|
git_version_ok
|
301
299
|
return unless git_repo? && tddium_settings && suite_for_current_branch?
|
302
300
|
|
@@ -325,9 +323,8 @@ class Tddium < Thor
|
|
325
323
|
method_option :pull_url, :type => :string, :default => nil
|
326
324
|
method_option :push_url, :type => :string, :default => nil
|
327
325
|
method_option :test_pattern, :type => :string, :default => nil
|
328
|
-
method_option :environment, :type => :string, :default => nil
|
329
326
|
def suite
|
330
|
-
set_default_environment
|
327
|
+
set_default_environment
|
331
328
|
git_version_ok
|
332
329
|
return unless git_repo? && tddium_settings
|
333
330
|
|
@@ -436,7 +433,7 @@ class Tddium < Thor
|
|
436
433
|
end
|
437
434
|
|
438
435
|
def current_git_branch
|
439
|
-
@current_git_branch ||=
|
436
|
+
@current_git_branch ||= `git symbolic-ref HEAD`.gsub("\n", "").split("/")[2..-1].join("/")
|
440
437
|
end
|
441
438
|
|
442
439
|
def current_suite_id
|
@@ -506,7 +503,8 @@ class Tddium < Thor
|
|
506
503
|
params = {}
|
507
504
|
# prompt for email/invitation and password
|
508
505
|
if options[:invited]
|
509
|
-
|
506
|
+
token = options[:invitation_token] || ask(Text::Prompt::INVITATION_TOKEN)
|
507
|
+
params[:invitation_token] = token.strip
|
510
508
|
else
|
511
509
|
params[:email] = options[:email] || ask(Text::Prompt::EMAIL)
|
512
510
|
end
|
@@ -624,9 +622,11 @@ class Tddium < Thor
|
|
624
622
|
say(Text::Process::SETUP_CAMPFIRE_FIRST_TIME)
|
625
623
|
end
|
626
624
|
|
627
|
-
ask_or_update.call(:campfire_subdomain, Text::Prompt::CAMPFIRE_SUBDOMAIN, nil)
|
628
|
-
|
629
|
-
|
625
|
+
subdomain = ask_or_update.call(:campfire_subdomain, Text::Prompt::CAMPFIRE_SUBDOMAIN, nil)
|
626
|
+
if !subdomain.nil? && subdomain != 'disable' then
|
627
|
+
ask_or_update.call(:campfire_token, Text::Prompt::CAMPFIRE_TOKEN, nil)
|
628
|
+
ask_or_update.call(:campfire_room, Text::Prompt::CAMPFIRE_ROOM, nil)
|
629
|
+
end
|
630
630
|
end
|
631
631
|
|
632
632
|
def update_suite(suite, options)
|
@@ -675,13 +675,19 @@ class Tddium < Thor
|
|
675
675
|
end
|
676
676
|
end
|
677
677
|
|
678
|
-
def set_default_environment
|
678
|
+
def set_default_environment
|
679
|
+
env = options[:environment]
|
679
680
|
if env.nil?
|
680
681
|
tddium_client.environment = :development
|
681
682
|
tddium_client.environment = :production unless File.exists?(tddium_file_name)
|
682
683
|
else
|
683
684
|
tddium_client.environment = env.to_sym
|
684
685
|
end
|
686
|
+
|
687
|
+
port = options[:port] || ENV['TDDIUM_CLIENT_PORT']
|
688
|
+
if port
|
689
|
+
tddium_client.port = port.to_i
|
690
|
+
end
|
685
691
|
end
|
686
692
|
|
687
693
|
def show_session_details(params, no_session_prompt, all_session_prompt)
|
data/lib/tddium/version.rb
CHANGED
data/spec/tddium_spec.rb
CHANGED
@@ -14,6 +14,7 @@ describe Tddium do
|
|
14
14
|
SAMPLE_API_KEY = "afb12412bdafe124124asfasfabebafeabwbawf1312342erbfasbb"
|
15
15
|
SAMPLE_APP_NAME = "tddelicious"
|
16
16
|
SAMPLE_BRANCH_NAME = "test"
|
17
|
+
SAMPLE_REF_NAME = "refs/heads/test"
|
17
18
|
SAMPLE_BUNDLER_VERSION = "Bundler version 1.10.10"
|
18
19
|
SAMPLE_DATE_TIME = "2011-03-11T08:43:02Z"
|
19
20
|
SAMPLE_EMAIL = "someone@example.com"
|
@@ -195,7 +196,7 @@ describe Tddium do
|
|
195
196
|
create_file(Tddium::Git::GITIGNORE, "something")
|
196
197
|
end
|
197
198
|
|
198
|
-
def stub_git_branch(tddium, default_branch_name =
|
199
|
+
def stub_git_branch(tddium, default_branch_name = SAMPLE_REF_NAME)
|
199
200
|
tddium.stub(:`).with("git symbolic-ref HEAD").and_return(default_branch_name)
|
200
201
|
end
|
201
202
|
|
@@ -755,6 +756,8 @@ describe Tddium do
|
|
755
756
|
before do
|
756
757
|
stub_config_file(:api_key => SAMPLE_API_KEY)
|
757
758
|
stub_call_api_response(:get, Tddium::Api::Path::USERS, SAMPLE_USER_RESPONSE)
|
759
|
+
stub_call_api_response(:get, Tddium::Api::Path::SUITES, {"suites" => []})
|
760
|
+
stub_call_api_response(:get, Tddium::Api::Path::ACCOUNT_USAGE, {"usage" => "something"})
|
758
761
|
end
|
759
762
|
|
760
763
|
it "should show the user's email address" do
|
@@ -934,30 +937,6 @@ describe Tddium do
|
|
934
937
|
end
|
935
938
|
end
|
936
939
|
|
937
|
-
describe "#logout" do
|
938
|
-
before { stub_defaults }
|
939
|
-
|
940
|
-
context ".tddium file exists" do
|
941
|
-
before { stub_config_file }
|
942
|
-
it "should delete the file" do
|
943
|
-
run_logout(tddium)
|
944
|
-
File.should_not be_exists(SAMPLE_TDDIUM_CONFIG_FILE)
|
945
|
-
end
|
946
|
-
end
|
947
|
-
|
948
|
-
context ".tddium file does not exists" do
|
949
|
-
it "should do nothing" do
|
950
|
-
FileUtils.should_not_receive(:rm)
|
951
|
-
run_logout(tddium)
|
952
|
-
end
|
953
|
-
end
|
954
|
-
|
955
|
-
it "should show the user: '#{Tddium::Text::Process::LOGGED_OUT_SUCCESSFULLY}'" do
|
956
|
-
tddium.should_receive(:say).with(Tddium::Text::Process::LOGGED_OUT_SUCCESSFULLY)
|
957
|
-
run_logout(tddium)
|
958
|
-
end
|
959
|
-
end
|
960
|
-
|
961
940
|
describe "#spec" do
|
962
941
|
before do
|
963
942
|
stub_defaults
|
@@ -1457,11 +1436,18 @@ describe Tddium do
|
|
1457
1436
|
end
|
1458
1437
|
|
1459
1438
|
it "should prompt for campfire" do
|
1460
|
-
tddium.should_receive(:ask).with(Tddium::Text::Prompt::CAMPFIRE_SUBDOMAIN % current['campfire_subdomain'], anything)
|
1439
|
+
tddium.should_receive(:ask).with(Tddium::Text::Prompt::CAMPFIRE_SUBDOMAIN % current['campfire_subdomain'], anything).and_return('tddium')
|
1461
1440
|
tddium.should_receive(:ask).with(Tddium::Text::Prompt::CAMPFIRE_TOKEN % current['campfire_token'], anything)
|
1462
1441
|
tddium.should_receive(:ask).with(Tddium::Text::Prompt::CAMPFIRE_ROOM % current['campfire_room'], anything)
|
1463
1442
|
run_suite(tddium, options)
|
1464
1443
|
end
|
1444
|
+
|
1445
|
+
it "should not prompt for campfire token or room if no domain" do
|
1446
|
+
tddium.should_receive(:ask).with(Tddium::Text::Prompt::CAMPFIRE_SUBDOMAIN % current['campfire_subdomain'], anything).and_return('disable')
|
1447
|
+
tddium.should_not_receive(:ask).with(Tddium::Text::Prompt::CAMPFIRE_TOKEN % current['campfire_token'], anything)
|
1448
|
+
tddium.should_not_receive(:ask).with(Tddium::Text::Prompt::CAMPFIRE_ROOM % current['campfire_room'], anything)
|
1449
|
+
run_suite(tddium, options)
|
1450
|
+
end
|
1465
1451
|
end
|
1466
1452
|
|
1467
1453
|
it_should_behave_like "set the default environment"
|
data/tddium.gemspec
CHANGED
@@ -35,7 +35,7 @@ EOF
|
|
35
35
|
s.add_runtime_dependency("thor")
|
36
36
|
s.add_runtime_dependency("highline")
|
37
37
|
s.add_runtime_dependency("json")
|
38
|
-
s.add_runtime_dependency("tddium_client", ">=0.0.
|
38
|
+
s.add_runtime_dependency("tddium_client", ">=0.0.10")
|
39
39
|
s.add_runtime_dependency("tddium_reporting", ">=0.0.3")
|
40
40
|
s.add_runtime_dependency("bundler")
|
41
41
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: tddium-preview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.4
|
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-08-
|
13
|
+
date: 2011-08-30 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 0.0.
|
57
|
+
version: 0.0.10
|
58
58
|
type: :runtime
|
59
59
|
version_requirements: *id004
|
60
60
|
- !ruby/object:Gem::Dependency
|
@@ -151,9 +151,15 @@ files:
|
|
151
151
|
- README.rdoc
|
152
152
|
- Rakefile
|
153
153
|
- bin/tddium
|
154
|
-
- features/
|
154
|
+
- features/login_command.feature
|
155
|
+
- features/logout_command.feature
|
156
|
+
- features/step_definitions/aruba_steps.rb
|
155
157
|
- features/step_definitions/login_steps.rb
|
156
158
|
- features/step_definitions/mimic_steps.rb
|
159
|
+
- features/step_definitions/suite_steps.rb
|
160
|
+
- features/suite_command.feature
|
161
|
+
- features/support/aruba.rb
|
162
|
+
- features/support/constants.rb
|
157
163
|
- features/support/env.rb
|
158
164
|
- features/support/mimic.rb
|
159
165
|
- lib/tddium.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
@mimic
|
2
|
-
Feature: Manage Login
|
3
|
-
|
4
|
-
Scenario: Log in successfully
|
5
|
-
Given the user can log in and gets API key "apikey"
|
6
|
-
#When I run `tddium login --environment=mimic --email=user@example.org --password=password`
|
7
|
-
When I run `tddium login --environment=mimic` interactively
|
8
|
-
And I type "foo@example.com"
|
9
|
-
And I type "barbarbar"
|
10
|
-
And the console session ends
|
11
|
-
Then the output should contain:
|
12
|
-
"""
|
13
|
-
Logged in successfully
|
14
|
-
"""
|
15
|
-
And the exit status should be 0
|
16
|
-
And the file ".tddium.mimic" should contain "apikey"
|
17
|
-
And the file ".gitignore" should contain ".tddium.mimic"
|
18
|
-
And the file ".gitignore" should contain ".tddium-deploy-key.mimic"
|