crab 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +12 -12
- data/bin/crab-help +9 -13
- data/bin/crab-iteration +18 -0
- data/bin/crab-iteration-help +11 -0
- data/bin/crab-login +2 -2
- data/bin/crab-logout +18 -0
- data/bin/crab-project +1 -1
- data/bin/{crab-tc → crab-release} +4 -4
- data/bin/crab-release-help +11 -0
- data/bin/crab-story +18 -0
- data/bin/{crab-add → crab-story-add} +2 -2
- data/bin/{crab-change → crab-story-change} +4 -4
- data/bin/{crab-new → crab-story-create} +2 -2
- data/bin/{crab-remove → crab-story-del} +3 -3
- data/bin/{crab-delete → crab-story-delete} +3 -3
- data/bin/{crab-find → crab-story-find} +2 -2
- data/bin/crab-story-help +11 -0
- data/bin/{crab-ls → crab-story-list} +2 -2
- data/bin/{crab-list → crab-story-ls} +2 -2
- data/bin/{crab-move → crab-story-move} +2 -2
- data/bin/{crab-mv → crab-story-mv} +2 -2
- data/bin/{crab-create → crab-story-new} +2 -2
- data/bin/{crab-pull → crab-story-pull} +2 -2
- data/bin/{crab-rename → crab-story-ren} +2 -2
- data/bin/crab-story-rename +27 -0
- data/bin/{crab-rm → crab-story-rm} +3 -3
- data/bin/{crab-show → crab-story-show} +2 -2
- data/bin/{crab-up → crab-story-up} +4 -4
- data/bin/{crab-update → crab-story-update} +4 -4
- data/bin/crab-testcase +1 -1
- data/bin/crab-testcase-add +5 -1
- data/bin/crab-testcase-change +18 -0
- data/bin/crab-testcase-create +5 -1
- data/bin/crab-testcase-del +18 -0
- data/bin/crab-testcase-delete +5 -1
- data/bin/crab-testcase-find +10 -0
- data/bin/crab-testcase-help +11 -5
- data/bin/crab-testcase-list +1 -1
- data/bin/crab-testcase-ls +6 -21
- data/bin/crab-testcase-new +5 -1
- data/bin/crab-testcase-rm +5 -1
- data/bin/crab-testcase-show +1 -1
- data/bin/crab-testcase-up +18 -0
- data/bin/crab-testcase-update +5 -1
- data/features/find-text-in-stories.feature +3 -3
- data/features/login-and-out-of-rally.feature +1 -2
- data/features/move-in-rally.feature +2 -2
- data/features/pull-from-rally-into-cucumber.feature +4 -4
- data/features/show-from-rally.feature +3 -3
- data/features/steps/rally_steps.rb +45 -59
- data/features/subcommand-help.feature +28 -89
- data/features/update-story-in-rally.feature +8 -8
- data/lib/crab/rally.rb +4 -4
- data/lib/crab/version.rb +1 -1
- metadata +62 -42
- data/bin/crab-del +0 -21
@@ -3,15 +3,15 @@ require 'crab'
|
|
3
3
|
|
4
4
|
opts = Trollop::options do
|
5
5
|
banner <<-BANNER
|
6
|
-
crab delete: delete an existing story in Rally
|
6
|
+
crab story delete: delete an existing story in Rally
|
7
7
|
|
8
|
-
Usage: crab delete
|
8
|
+
Usage: crab story delete <id> [options*]
|
9
9
|
BANNER
|
10
10
|
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
11
11
|
end
|
12
12
|
|
13
13
|
id = ARGV.join(" ")
|
14
|
-
Trollop::die "Story ID must be specified" if
|
14
|
+
Trollop::die "Story ID must be specified" if id.blank?
|
15
15
|
|
16
16
|
Crab::Rally.new(opts[:dry]) do |rally|
|
17
17
|
story = rally.find_story_with_id id
|
@@ -3,9 +3,9 @@ require 'crab'
|
|
3
3
|
|
4
4
|
opts = Trollop::options do
|
5
5
|
banner <<-BANNER
|
6
|
-
crab show: displays a story in Rally as a Cucumber feature
|
6
|
+
crab story show: displays a story in Rally as a Cucumber feature
|
7
7
|
|
8
|
-
Usage: crab show
|
8
|
+
Usage: crab story show <id> [options*]"
|
9
9
|
BANNER
|
10
10
|
opt :language, "Language to display Cucumber features in (ISO code)", :default => "en", :short => "-l"
|
11
11
|
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
@@ -5,9 +5,9 @@ include Crab::Utilities
|
|
5
5
|
|
6
6
|
cmd_opts = Trollop::options do
|
7
7
|
banner <<-BANNER
|
8
|
-
crab update: update a story in Rally
|
8
|
+
crab story update: update a story in Rally
|
9
9
|
|
10
|
-
Usage: crab update
|
10
|
+
Usage: crab story update <id> [options*]
|
11
11
|
BANNER
|
12
12
|
opt :name, "Name (title)", :type => String, :short => "-n"
|
13
13
|
opt :state, "State (one of: #{Crab::Story::VALID_STATES.join(" ")})", :type => String, :short => "-t"
|
@@ -40,12 +40,12 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
40
40
|
story = rally.find_story_with_id ARGV.first
|
41
41
|
|
42
42
|
if cmd_opts[:iteration_given]
|
43
|
-
opts[:iteration] = rally.find_iteration_by_name cmd_opts[:iteration]
|
43
|
+
opts[:iteration] = rally.find_iteration_by_name cmd_opts[:iteration], story.project
|
44
44
|
Trollop::die "Unknown iteration \"#{cmd_opts[:iteration]}\"" if opts[:iteration].nil?
|
45
45
|
end
|
46
46
|
|
47
47
|
if cmd_opts[:release_given]
|
48
|
-
opts[:release] = rally.find_release_by_name cmd_opts[:release]
|
48
|
+
opts[:release] = rally.find_release_by_name cmd_opts[:release], story.project
|
49
49
|
Trollop::die "Unknown release \"#{cmd_opts[:release]}\"" if opts[:release].nil?
|
50
50
|
end
|
51
51
|
|
@@ -5,9 +5,9 @@ include Crab::Utilities
|
|
5
5
|
|
6
6
|
cmd_opts = Trollop::options do
|
7
7
|
banner <<-BANNER
|
8
|
-
crab update: update a story in Rally
|
8
|
+
crab story update: update a story in Rally
|
9
9
|
|
10
|
-
Usage: crab update
|
10
|
+
Usage: crab story update <id> [options*]
|
11
11
|
BANNER
|
12
12
|
opt :name, "Name (title)", :type => String, :short => "-n"
|
13
13
|
opt :state, "State (one of: #{Crab::Story::VALID_STATES.join(" ")})", :type => String, :short => "-t"
|
@@ -40,12 +40,12 @@ Crab::Rally.new(opts[:dry]) do |rally|
|
|
40
40
|
story = rally.find_story_with_id ARGV.first
|
41
41
|
|
42
42
|
if cmd_opts[:iteration_given]
|
43
|
-
opts[:iteration] = rally.find_iteration_by_name cmd_opts[:iteration]
|
43
|
+
opts[:iteration] = rally.find_iteration_by_name cmd_opts[:iteration], story.project
|
44
44
|
Trollop::die "Unknown iteration \"#{cmd_opts[:iteration]}\"" if opts[:iteration].nil?
|
45
45
|
end
|
46
46
|
|
47
47
|
if cmd_opts[:release_given]
|
48
|
-
opts[:release] = rally.find_release_by_name cmd_opts[:release]
|
48
|
+
opts[:release] = rally.find_release_by_name cmd_opts[:release], story.project
|
49
49
|
Trollop::die "Unknown release \"#{cmd_opts[:release]}\"" if opts[:release].nil?
|
50
50
|
end
|
51
51
|
|
data/bin/crab-testcase
CHANGED
@@ -11,7 +11,7 @@ end
|
|
11
11
|
|
12
12
|
unless system("crab-testcase-#{cmd}", *ARGV)
|
13
13
|
if $?.exitstatus == 127 # bash 'command not found'
|
14
|
-
$stderr.puts "Unknown subcommand \"
|
14
|
+
$stderr.puts "Unknown subcommand \"testcase #{cmd}\""
|
15
15
|
system "crab-testcase-help"
|
16
16
|
exit 127
|
17
17
|
end
|
data/bin/crab-testcase-add
CHANGED
@@ -3,7 +3,11 @@ require 'crab'
|
|
3
3
|
|
4
4
|
include Crab::Utilities
|
5
5
|
|
6
|
-
opts = add_or_update_options
|
6
|
+
opts = add_or_update_options <<-BANNER
|
7
|
+
crab testcase create: add a test case to a story in Rally
|
8
|
+
|
9
|
+
Usage: crab testcase create <story> <name> [options*]
|
10
|
+
BANNER
|
7
11
|
|
8
12
|
story_id = ARGV.shift
|
9
13
|
unless story_id
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
include Crab::Utilities
|
5
|
+
|
6
|
+
opts = add_or_update_options <<-BANNER
|
7
|
+
crab testcase update: update a test case in Rally
|
8
|
+
|
9
|
+
Usage: crab testcase update <id> [options*]
|
10
|
+
BANNER
|
11
|
+
|
12
|
+
tc_id = ARGV.shift
|
13
|
+
|
14
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
15
|
+
tc = rally.find_test_case(tc_id)
|
16
|
+
tc.update(sanitize_options(opts))
|
17
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
18
|
+
end
|
data/bin/crab-testcase-create
CHANGED
@@ -3,7 +3,11 @@ require 'crab'
|
|
3
3
|
|
4
4
|
include Crab::Utilities
|
5
5
|
|
6
|
-
opts = add_or_update_options
|
6
|
+
opts = add_or_update_options <<-BANNER
|
7
|
+
crab testcase create: add a test case to a story in Rally
|
8
|
+
|
9
|
+
Usage: crab testcase create <story> <name> [options*]
|
10
|
+
BANNER
|
7
11
|
|
8
12
|
story_id = ARGV.shift
|
9
13
|
unless story_id
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
Trollop::options do
|
5
|
+
banner <<-BANNER
|
6
|
+
crab testcase delete: delete a test case in Rally
|
7
|
+
|
8
|
+
Usage: crab testcase delete <id> [options*]
|
9
|
+
BANNER
|
10
|
+
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
11
|
+
end
|
12
|
+
|
13
|
+
tc_id = ARGV.shift
|
14
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
15
|
+
tc = rally.find_test_case(tc_id)
|
16
|
+
tc.delete
|
17
|
+
puts "Test case #{tc_id} deleted."
|
18
|
+
end
|
data/bin/crab-testcase-delete
CHANGED
@@ -2,7 +2,11 @@
|
|
2
2
|
require 'crab'
|
3
3
|
|
4
4
|
Trollop::options do
|
5
|
-
banner
|
5
|
+
banner <<-BANNER
|
6
|
+
crab testcase delete: delete a test case in Rally
|
7
|
+
|
8
|
+
Usage: crab testcase delete <id> [options*]
|
9
|
+
BANNER
|
6
10
|
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
7
11
|
end
|
8
12
|
|
data/bin/crab-testcase-help
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
# vim: set ft=ruby :
|
2
|
-
require 'crab'
|
3
2
|
|
4
3
|
puts <<-HELP
|
5
|
-
crab testcase
|
4
|
+
Usage: crab testcase <command> [options*]
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
Available commands:
|
7
|
+
|
8
|
+
create Create a new test case in a story
|
9
|
+
delete Delete an existing test case
|
10
|
+
help Show this help text
|
11
|
+
list List test cases in a story
|
12
|
+
show Show a test case (and its steps) as a Cucumber scenario
|
13
|
+
update Update a test case (name, priority, testing method, etc)
|
14
|
+
|
15
|
+
--help, -h: Show this message
|
10
16
|
HELP
|
data/bin/crab-testcase-list
CHANGED
@@ -5,7 +5,7 @@ opts = Trollop::options do
|
|
5
5
|
banner <<-BANNER
|
6
6
|
crab testcase list: displays all testcases in Rally in a story as Cucumber scenarios
|
7
7
|
|
8
|
-
Usage: crab testcase list <story> [options]"
|
8
|
+
Usage: crab testcase list <story> [options*]"
|
9
9
|
BANNER
|
10
10
|
opt :language, "Language to display Cucumber features in (ISO code)", :default => "en", :short => "-l"
|
11
11
|
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
data/bin/crab-testcase-ls
CHANGED
@@ -1,25 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
# vim: set ft=ruby :
|
2
|
-
require 'crab'
|
3
|
-
|
4
|
-
opts = Trollop::options do
|
5
|
-
banner <<-BANNER
|
6
|
-
crab testcase list: displays all testcases in Rally in a story as Cucumber scenarios
|
7
3
|
|
8
|
-
|
9
|
-
BANNER
|
10
|
-
opt :language, "Language to display Cucumber features in (ISO code)", :default => "en", :short => "-l"
|
11
|
-
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
12
|
-
end
|
13
|
-
|
14
|
-
id = ARGV.shift
|
15
|
-
unless id
|
16
|
-
$stderr.puts "Error: No story ID provided."
|
17
|
-
system "crab-testcase-help"
|
18
|
-
exit 1
|
19
|
-
end
|
4
|
+
require 'crab'
|
20
5
|
|
21
|
-
|
22
|
-
|
6
|
+
puts <<-BANNER
|
7
|
+
crab testcase find: find a test case in Rally
|
23
8
|
|
24
|
-
|
25
|
-
|
9
|
+
Usage: crab testcase find <story> [options*]
|
10
|
+
BANNER
|
data/bin/crab-testcase-new
CHANGED
@@ -3,7 +3,11 @@ require 'crab'
|
|
3
3
|
|
4
4
|
include Crab::Utilities
|
5
5
|
|
6
|
-
opts = add_or_update_options
|
6
|
+
opts = add_or_update_options <<-BANNER
|
7
|
+
crab testcase create: add a test case to a story in Rally
|
8
|
+
|
9
|
+
Usage: crab testcase create <story> <name> [options*]
|
10
|
+
BANNER
|
7
11
|
|
8
12
|
story_id = ARGV.shift
|
9
13
|
unless story_id
|
data/bin/crab-testcase-rm
CHANGED
@@ -2,7 +2,11 @@
|
|
2
2
|
require 'crab'
|
3
3
|
|
4
4
|
Trollop::options do
|
5
|
-
banner
|
5
|
+
banner <<-BANNER
|
6
|
+
crab testcase delete: delete a test case in Rally
|
7
|
+
|
8
|
+
Usage: crab testcase delete <id> [options*]
|
9
|
+
BANNER
|
6
10
|
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
7
11
|
end
|
8
12
|
|
data/bin/crab-testcase-show
CHANGED
@@ -5,7 +5,7 @@ opts = Trollop::options do
|
|
5
5
|
banner <<-BANNER
|
6
6
|
crab testcase show: displays a testcase in Rally as a Cucumber scenario
|
7
7
|
|
8
|
-
Usage: crab testcase show <
|
8
|
+
Usage: crab testcase show <id> [options*]"
|
9
9
|
BANNER
|
10
10
|
opt :language, "Language to display Cucumber features in (ISO code)", :default => "en", :short => "-l"
|
11
11
|
opt :dry, "Dry-run (don't change anything)", :short => "-D", :default => false
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# vim: set ft=ruby :
|
2
|
+
require 'crab'
|
3
|
+
|
4
|
+
include Crab::Utilities
|
5
|
+
|
6
|
+
opts = add_or_update_options <<-BANNER
|
7
|
+
crab testcase update: update a test case in Rally
|
8
|
+
|
9
|
+
Usage: crab testcase update <id> [options*]
|
10
|
+
BANNER
|
11
|
+
|
12
|
+
tc_id = ARGV.shift
|
13
|
+
|
14
|
+
Crab::Rally.new(opts[:dry]) do |rally|
|
15
|
+
tc = rally.find_test_case(tc_id)
|
16
|
+
tc.update(sanitize_options(opts))
|
17
|
+
puts "#{tc.story.formatted_id}/#{tc.formatted_id}: #{tc.name} (#{tc.tags.join(" ")})"
|
18
|
+
end
|
data/bin/crab-testcase-update
CHANGED
@@ -3,7 +3,11 @@ require 'crab'
|
|
3
3
|
|
4
4
|
include Crab::Utilities
|
5
5
|
|
6
|
-
opts = add_or_update_options
|
6
|
+
opts = add_or_update_options <<-BANNER
|
7
|
+
crab testcase update: update a test case in Rally
|
8
|
+
|
9
|
+
Usage: crab testcase update <id> [options*]
|
10
|
+
BANNER
|
7
11
|
|
8
12
|
tc_id = ARGV.shift
|
9
13
|
|
@@ -9,7 +9,7 @@ Feature: Find Text in Stories
|
|
9
9
|
And I have selected my test project
|
10
10
|
|
11
11
|
Scenario: Matching Name
|
12
|
-
When I run `crab find Sample Crab`
|
12
|
+
When I run `crab story find Sample Crab`
|
13
13
|
Then the output should contain:
|
14
14
|
"""
|
15
15
|
US4988: Sample Crab Story (grooming)
|
@@ -19,11 +19,11 @@ Feature: Find Text in Stories
|
|
19
19
|
@quick
|
20
20
|
Scenario: Project Must be Specified If Not Set
|
21
21
|
Given no project is selected
|
22
|
-
When I run `crab find pattern`
|
22
|
+
When I run `crab story find pattern`
|
23
23
|
Then the output should contain "Error: argument --project must be specified."
|
24
24
|
|
25
25
|
Scenario: Project Must Exist
|
26
|
-
When I run `crab find --project "foo" pattern`
|
26
|
+
When I run `crab story find --project "foo" pattern`
|
27
27
|
Then the output should contain:
|
28
28
|
"""
|
29
29
|
Error: Project "foo" not found.
|
@@ -1,11 +1,10 @@
|
|
1
1
|
Feature: Log In and Out of Rally
|
2
|
-
|
2
|
+
|
3
3
|
In order to avoid typing his credentials all the time
|
4
4
|
A lazy and security-conscious developer
|
5
5
|
Wants to log in and out of Rally in order to perform operations
|
6
6
|
|
7
7
|
Scenario: Logged Out, Logging In
|
8
|
-
Given I am logged out
|
9
8
|
When I run `crab login` interactively
|
10
9
|
And I type my username
|
11
10
|
And I type my password
|
@@ -8,8 +8,8 @@ Feature: Move in Rally
|
|
8
8
|
Given I am logged in
|
9
9
|
|
10
10
|
Scenario: Move Then Go Back
|
11
|
-
When I run `crab move US4988`
|
11
|
+
When I run `crab story move US4988`
|
12
12
|
Then the output should contain "US4988: Sample Crab Story (defined)"
|
13
13
|
|
14
|
-
When I run `crab move US4988 --back`
|
14
|
+
When I run `crab story move US4988 --back`
|
15
15
|
Then the output should contain "US4988: Sample Crab Story (grooming)"
|
@@ -1,16 +1,16 @@
|
|
1
1
|
Feature: Pull From Rally Into Cucumber
|
2
|
-
|
2
|
+
|
3
3
|
In order to begin development of a story that was written in Rally
|
4
4
|
A developer who doesn't want to open a browser or click things
|
5
5
|
Wants the story converted into the much nicer Cucumber format
|
6
6
|
|
7
|
-
Background:
|
7
|
+
Background:
|
8
8
|
Given I am logged in
|
9
9
|
|
10
10
|
Scenario: Pulling a Single Story
|
11
11
|
Given a directory named "crab-pull"
|
12
12
|
And I cd to "crab-pull"
|
13
|
-
When I run `crab pull US4988`
|
13
|
+
When I run `crab story pull US4988`
|
14
14
|
Then the output should contain "US4988: features/grooming/US4988-sample-crab-story.feature"
|
15
15
|
And a directory named "features" should exist
|
16
16
|
And a file named "features/grooming/US4988-sample-crab-story.feature" should exist
|
@@ -23,7 +23,7 @@ Feature: Pull From Rally Into Cucumber
|
|
23
23
|
"""
|
24
24
|
|
25
25
|
Scenario: Pulling Multiple Stories
|
26
|
-
When I run `crab pull US4988 US5000`
|
26
|
+
When I run `crab story pull US4988 US5000`
|
27
27
|
Then the output should contain "US4988: features/grooming/US4988-sample-crab-story.feature"
|
28
28
|
Then the output should contain "US5000: features/grooming/US5000-sample-crab-parent-story.feature"
|
29
29
|
|
@@ -8,7 +8,7 @@ Feature: Show Story From Rally
|
|
8
8
|
Given I am logged in
|
9
9
|
|
10
10
|
Scenario: Show Simple Story
|
11
|
-
When I run `crab show US4988`
|
11
|
+
When I run `crab story show US4988`
|
12
12
|
Then the output should contain:
|
13
13
|
"""
|
14
14
|
Feature: [US4988] Sample Crab Story
|
@@ -17,7 +17,7 @@ Feature: Show Story From Rally
|
|
17
17
|
"""
|
18
18
|
|
19
19
|
Scenario: Show Story With Test Cases
|
20
|
-
When I run `crab show US5000`
|
20
|
+
When I run `crab story show US5000`
|
21
21
|
Then the output should contain "Feature: [US5000] Sample Crab Parent Story"
|
22
22
|
And the output should contain "@important @medium @manual @acceptance"
|
23
23
|
And the output should contain "Scenario: [TC10388] Sample Testcase"
|
@@ -26,7 +26,7 @@ Feature: Show Story From Rally
|
|
26
26
|
And the output should contain " Then I should be able to export them into Cucumber format"
|
27
27
|
|
28
28
|
Scenario: Story In Different Language
|
29
|
-
When I run `crab show US5000 --language pt`
|
29
|
+
When I run `crab story show US5000 --language pt`
|
30
30
|
Then the output should contain "Funcionalidade: "
|
31
31
|
And the output should contain "Cenario: "
|
32
32
|
|
@@ -1,5 +1,41 @@
|
|
1
1
|
require 'rally_rest_api'
|
2
2
|
|
3
|
+
def get_rally_credentials
|
4
|
+
file = File.expand_path("~/.crab/tests/credentials")
|
5
|
+
|
6
|
+
if File.exists? file
|
7
|
+
username, password = File.read(file).split(/\n/)
|
8
|
+
[ username, password ]
|
9
|
+
else
|
10
|
+
raise "Please run rake cucumber:setup first"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_rally
|
15
|
+
username, password = get_rally_credentials
|
16
|
+
@rally = RallyRestAPI.new :username => username, :password => password
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_story(story_id)
|
20
|
+
get_rally.find(:hierarchical_requirement, :fetch => true) { equal :formatted_i_d, story_id }.first
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_project
|
24
|
+
if File.exists? ".crab/tests/project"
|
25
|
+
File.read(".crab/tests/project").strip
|
26
|
+
else
|
27
|
+
raise "Please run rake cucumber:setup first"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_test_project
|
32
|
+
begin
|
33
|
+
test_project = File.read(File.expand_path("~/.crab/tests/project"))
|
34
|
+
rescue
|
35
|
+
raise "Looks like your test project isn't set up. Please run 'rake cucumber:setup'"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
3
39
|
Then /^I should see a usage screen$/ do
|
4
40
|
Then "the output should contain:", <<-TEXT
|
5
41
|
Usage: crab <command> [options*]
|
@@ -8,48 +44,24 @@ crab version #{Crab::VERSION}: A Cucumber-Rally bridge
|
|
8
44
|
|
9
45
|
Available commands:
|
10
46
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
show Show a story (and its test cases) as a Cucumber feature
|
20
|
-
testcase Manage test cases in a story (add, update, delete)
|
21
|
-
update Update a story (name, estimate, etc)
|
22
|
-
|
47
|
+
help Show this help text
|
48
|
+
iteration Manipulate iterations
|
49
|
+
login Persistently authenticate user with Rally
|
50
|
+
logout Remove stored Rally credentials
|
51
|
+
project Persistently select project to work with in Rally
|
52
|
+
release Manipulate releases
|
53
|
+
story Manipulate stories
|
54
|
+
testcase Manipulate test cases
|
23
55
|
|
24
56
|
--version, -v: Print version and exit
|
25
57
|
--help, -h: Show this message
|
26
58
|
TEXT
|
27
59
|
end
|
28
60
|
|
29
|
-
Given /^I am logged out$/ do
|
30
|
-
end
|
31
|
-
|
32
|
-
Given /^an instance of Rally$/ do
|
33
|
-
end
|
34
|
-
|
35
|
-
Given /^Rally has a story with ID "([^"]*)"$/ do |arg1|
|
36
|
-
end
|
37
|
-
|
38
61
|
Then /^the user's home directory should have a file named "([^"]*)"$/ do |file|
|
39
62
|
File.exists? File.expand_path("~/#{file}")
|
40
63
|
end
|
41
64
|
|
42
|
-
def get_rally_credentials
|
43
|
-
file = File.expand_path("~/.crab/tests/credentials")
|
44
|
-
|
45
|
-
if File.exists? file
|
46
|
-
username, password = File.read(file).split(/\n/)
|
47
|
-
[ username, password ]
|
48
|
-
else
|
49
|
-
raise "Please run rake cucumber:setup first"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
65
|
When /^I type my username$/ do
|
54
66
|
When %Q{I type "#{get_rally_credentials.first}"}
|
55
67
|
end
|
@@ -61,9 +73,8 @@ end
|
|
61
73
|
Given /^I am logged in$/ do
|
62
74
|
username, password = get_rally_credentials
|
63
75
|
steps %Q{
|
64
|
-
Given I am logged out
|
65
76
|
When I run `crab login -u #{username} -p #{password}`
|
66
|
-
Then the output should contain "
|
77
|
+
Then the output should contain "Credentials stored for #{username}"
|
67
78
|
}
|
68
79
|
end
|
69
80
|
|
@@ -71,15 +82,6 @@ Then /^a file named "([^"]*)" in the user's home directory should exist$/ do |ar
|
|
71
82
|
pending # express the regexp above with the code you wish you had
|
72
83
|
end
|
73
84
|
|
74
|
-
def get_rally
|
75
|
-
username, password = get_rally_credentials
|
76
|
-
@rally = RallyRestAPI.new :username => username, :password => password
|
77
|
-
end
|
78
|
-
|
79
|
-
def get_story(story_id)
|
80
|
-
get_rally.find(:hierarchical_requirement, :fetch => true) { equal :formatted_i_d, story_id }.first
|
81
|
-
end
|
82
|
-
|
83
85
|
Then /^the story ([A-Z]{2}\d+) should be blocked$/ do |story_id|
|
84
86
|
story = get_story(story_id)
|
85
87
|
story.blocked.should == "true"
|
@@ -110,14 +112,6 @@ Given /^no project is selected$/ do
|
|
110
112
|
Given 'I run `rm -rf ".crab/project"`'
|
111
113
|
end
|
112
114
|
|
113
|
-
def get_project
|
114
|
-
if File.exists? ".crab/tests/project"
|
115
|
-
File.read(".crab/tests/project").strip
|
116
|
-
else
|
117
|
-
raise "Please run rake cucumber:setup first"
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
115
|
Given /^I have selected the project "([^"]*)"$/ do |project|
|
122
116
|
unless get_project == project
|
123
117
|
steps %Q{
|
@@ -127,14 +121,6 @@ Given /^I have selected the project "([^"]*)"$/ do |project|
|
|
127
121
|
end
|
128
122
|
end
|
129
123
|
|
130
|
-
def get_test_project
|
131
|
-
begin
|
132
|
-
test_project = File.read(File.expand_path("~/.crab/tests/project"))
|
133
|
-
rescue
|
134
|
-
raise "Looks like your test project isn't set up. Please run 'rake cucumber:setup'"
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
124
|
Given /^I have selected my test project$/ do
|
139
125
|
When %Q{I run `crab project "#{get_test_project}"`}
|
140
126
|
end
|