rallytastic 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +51 -0
- data/LICENSE +20 -0
- data/README.rdoc +85 -0
- data/Rakefile +45 -0
- data/VERSION +1 -0
- data/lib/iteration.rb +52 -0
- data/lib/parsers/base.rb +23 -0
- data/lib/parsers/madison.rb +23 -0
- data/lib/project.rb +46 -0
- data/lib/rally/parsing_helpers.rb +70 -0
- data/lib/rally/rally_api.rb +102 -0
- data/lib/rallytastic.rb +30 -0
- data/lib/revision.rb +18 -0
- data/lib/revision_history.rb +19 -0
- data/lib/story.rb +101 -0
- data/lib/tasks/docs.thor +31 -0
- data/lib/tasks/scraper.thor +94 -0
- data/spec/fixtures/child_project.txt +1 -0
- data/spec/fixtures/iteration.txt +1 -0
- data/spec/fixtures/project.txt +1 -0
- data/spec/fixtures/story.txt +1 -0
- data/spec/fixtures/story_query.txt +1 -0
- data/spec/iteration_spec.rb +76 -0
- data/spec/project_spec.rb +64 -0
- data/spec/rally/rally_api_spec.rb +114 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/story_spec.rb +82 -0
- metadata +114 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
+
|
3
|
+
describe Project do
|
4
|
+
before do
|
5
|
+
@hash_vals = File.read(File.join(File.dirname(__FILE__), 'fixtures', 'project.txt'))
|
6
|
+
RallyAPI.stub(:get).and_return(eval(@hash_vals))
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "#associate" do
|
10
|
+
before do
|
11
|
+
@project = Project.new(:rally_uri => "http://testuri.com")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should associate project" do
|
15
|
+
@project.associate(eval(@hash_vals))
|
16
|
+
@project.parent.should_not be_nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
describe "looking up attrs from Rally for invalid project" do
|
22
|
+
before do
|
23
|
+
Project.collection.remove
|
24
|
+
@project = Project.new
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should raise error" do
|
28
|
+
lambda{@project.refresh}.should raise_error
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "looking up attrs from Rally for valid project" do
|
33
|
+
before do
|
34
|
+
Project.collection.remove
|
35
|
+
@name = "Down the hatch"
|
36
|
+
@project = Project.new(:rally_uri => "http://demouri.com")
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should accept a hash of values" do
|
40
|
+
RallyAPI.should_not_receive(:get)
|
41
|
+
@project.refresh eval(@hash_vals)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should pull name" do
|
45
|
+
@project.refresh
|
46
|
+
@project.name.should == @name
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should set description" do
|
50
|
+
@project.refresh
|
51
|
+
@project.description.should == "A nice description"
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should set the notes" do
|
55
|
+
@project.refresh
|
56
|
+
@project.notes.should == "some notes"
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should set the state" do
|
60
|
+
@project.refresh
|
61
|
+
@project.state.should == "Open"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
+
|
3
|
+
class MockResource
|
4
|
+
attr_accessor :rally_id, :rally_uri
|
5
|
+
|
6
|
+
def self.rally_uri
|
7
|
+
"/fake_resource.js"
|
8
|
+
end
|
9
|
+
|
10
|
+
def rally_uri
|
11
|
+
self.rally_uri
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe RallyAPI do
|
16
|
+
before(:all) do
|
17
|
+
RallyAPI::configure do |config|
|
18
|
+
config.user = "test_user"
|
19
|
+
config.password = "test_password"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
before(:each) do
|
24
|
+
RallyAPI.stub(:do_get).and_return("{}")
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#all" do
|
28
|
+
it "should pass endpoint" do
|
29
|
+
RallyAPI.should_receive(:do_get).with("/fake_resource.js",anything())
|
30
|
+
RallyAPI.all(MockResource, :conditions => {:name => "Fred"})
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should set query part of complex query" do
|
34
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("query" => '(Name = "Fred")'))
|
35
|
+
RallyAPI.all(MockResource, :start => 20, :conditions => {:name => "Fred"})
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should set start part of complex query" do
|
39
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("start" => 20))
|
40
|
+
RallyAPI.all(MockResource, :start => 20, :conditions => {:name => "Fred"})
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should set boolean fetch" do
|
44
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("fetch" => true))
|
45
|
+
RallyAPI.all(MockResource, :fetch => true)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should set start" do
|
49
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("start" => 20))
|
50
|
+
RallyAPI.all(MockResource, :start => 20)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should set pagesize" do
|
54
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("pagesize" => 20))
|
55
|
+
RallyAPI.all(MockResource, :pagesize => 20)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should accept an equality match" do
|
59
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("query" => '(Name = "Fred")'))
|
60
|
+
RallyAPI.all(MockResource, :conditions => {:name => "Fred"})
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should accept > match" do
|
64
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("query" => '(Count > "1")'))
|
65
|
+
RallyAPI.all(MockResource, :conditions => {:count.gt => 1})
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should accept >= match" do
|
69
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("query" => '(Count >= "1")'))
|
70
|
+
RallyAPI.all(MockResource, :conditions => {:count.gte => 1})
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should accept < match" do
|
74
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("query" => '(Count < "1")'))
|
75
|
+
RallyAPI.all(MockResource, :conditions => {:count.lt => 1})
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should accept =< match" do
|
79
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("query" => '(Count <= "1")'))
|
80
|
+
RallyAPI.all(MockResource, :conditions => {:count.lte => 1})
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should accept != match" do
|
84
|
+
RallyAPI.should_receive(:do_get).with(anything(), hash_including("query" => '(Count != "1")'))
|
85
|
+
RallyAPI.all(MockResource, :conditions => {:count.ne => 1})
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "configuration" do
|
90
|
+
before(:each) do
|
91
|
+
@mock_resource = MockResource.new
|
92
|
+
end
|
93
|
+
it "should set password" do
|
94
|
+
RallyAPI::configuration.password.should == "test_password"
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should set user" do
|
98
|
+
RallyAPI::configuration.user.should == "test_user"
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should degrade gracefully without password" do
|
102
|
+
RallyAPI::configuration.user = nil
|
103
|
+
lambda{RallyAPI.get @mock_resource}.should raise_error RallyAPI::CredentialsError
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should degrade gracefully without password" do
|
107
|
+
RallyAPI::configuration.password = nil
|
108
|
+
lambda{RallyAPI.get @mock_resource}.should raise_error RallyAPI::CredentialsError
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
+
require 'rallytastic'
|
4
|
+
require 'spec'
|
5
|
+
require 'spec/autorun'
|
6
|
+
|
7
|
+
Spec::Runner.configure do |config|
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
Mongoid.configure do |config|
|
13
|
+
name = "rallytastic_test"
|
14
|
+
host = "localhost"
|
15
|
+
config.master = Mongo::Connection.new.db(name)
|
16
|
+
config.persist_in_safe_mode = false
|
17
|
+
end
|
data/spec/story_spec.rb
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe Story do
|
4
|
+
describe "#associate" do
|
5
|
+
before do
|
6
|
+
@hash_vals = File.read(File.join(File.dirname(__FILE__), 'fixtures', 'story.txt'))
|
7
|
+
@story = Story.new(:rally_uri => "http://testuri.com")
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should associate parent" do
|
11
|
+
@story.associate(eval(@hash_vals)["HierarchicalRequirement"])
|
12
|
+
@story.parent.should_not be_nil
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should associate iteration" do
|
16
|
+
@story.associate(eval(@hash_vals)["HierarchicalRequirement"])
|
17
|
+
@story.iteration.should_not be_nil
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#refresh" do
|
23
|
+
before do
|
24
|
+
hash_vals = File.read(File.join(File.dirname(__FILE__), 'fixtures', 'story.txt'))
|
25
|
+
RallyAPI.stub(:get).and_return(eval(hash_vals))
|
26
|
+
@story = Story.new(:rally_uri => "http://testuri")
|
27
|
+
@story.refresh
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should set name" do
|
31
|
+
@story.name.should == "Run the marathon"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should set the rally_uri" do
|
35
|
+
@story.rally_uri.should == "https://rally1.rallydev.com/slm/webservice/1.19/hierarchicalrequirement/413668210.js"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should set the created_on" do
|
39
|
+
@story.created_on.should ==DateTime.parse("2009-06-11UTC")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should set the description" do
|
43
|
+
@story.description.should == "You've trained for it, now do it. Done when, you run 26.2 miles."
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should set the formatted_id" do
|
47
|
+
@story.formatted_id.should == "US26"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should set updated_on" do
|
51
|
+
@story.updated_on.should == Date.parse("2009-09-10T18:57:55.000Z")
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should set accepted_date" do
|
55
|
+
@story.accepted_on.should == DateTime.parse("2009-09-10T18:57:55.000Z")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should set blocked" do
|
59
|
+
@story.blocked.should === false
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should set plan_estimate" do
|
63
|
+
@story.plan_estimate.should == 3
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should set rank" do
|
67
|
+
@story.rank.should == "86292398717311774535928819836502410.432"
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should set schedule_state" do
|
71
|
+
@story.schedule_state.should == "Accepted"
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should set requested_due_date" do
|
75
|
+
@story.requested_due_date.should == Date.parse("2009-06-11T16:12:46.000Z")
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should set theme" do
|
79
|
+
@story.theme.should == "this is the theme"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rallytastic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Matt Clark
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-08-06 00:00:00 -05:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 9
|
31
|
+
version: 1.2.9
|
32
|
+
type: :development
|
33
|
+
prerelease: false
|
34
|
+
version_requirements: *id001
|
35
|
+
description: longer description of your gem
|
36
|
+
email: winescout@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- LICENSE
|
43
|
+
- README.rdoc
|
44
|
+
files:
|
45
|
+
- .document
|
46
|
+
- .gitignore
|
47
|
+
- Gemfile
|
48
|
+
- Gemfile.lock
|
49
|
+
- LICENSE
|
50
|
+
- README.rdoc
|
51
|
+
- Rakefile
|
52
|
+
- VERSION
|
53
|
+
- lib/iteration.rb
|
54
|
+
- lib/parsers/base.rb
|
55
|
+
- lib/parsers/madison.rb
|
56
|
+
- lib/project.rb
|
57
|
+
- lib/rally/parsing_helpers.rb
|
58
|
+
- lib/rally/rally_api.rb
|
59
|
+
- lib/rallytastic.rb
|
60
|
+
- lib/revision.rb
|
61
|
+
- lib/revision_history.rb
|
62
|
+
- lib/story.rb
|
63
|
+
- lib/tasks/docs.thor
|
64
|
+
- lib/tasks/scraper.thor
|
65
|
+
- spec/fixtures/child_project.txt
|
66
|
+
- spec/fixtures/iteration.txt
|
67
|
+
- spec/fixtures/project.txt
|
68
|
+
- spec/fixtures/story.txt
|
69
|
+
- spec/fixtures/story_query.txt
|
70
|
+
- spec/iteration_spec.rb
|
71
|
+
- spec/project_spec.rb
|
72
|
+
- spec/rally/rally_api_spec.rb
|
73
|
+
- spec/spec.opts
|
74
|
+
- spec/spec_helper.rb
|
75
|
+
- spec/story_spec.rb
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://github.com/winescout/rallytastic
|
78
|
+
licenses: []
|
79
|
+
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options:
|
82
|
+
- --charset=UTF-8
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3231742383853270632
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
requirements: []
|
103
|
+
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 1.3.7
|
106
|
+
signing_key:
|
107
|
+
specification_version: 3
|
108
|
+
summary: Its a Rally story teleporter
|
109
|
+
test_files:
|
110
|
+
- spec/iteration_spec.rb
|
111
|
+
- spec/project_spec.rb
|
112
|
+
- spec/rally/rally_api_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
- spec/story_spec.rb
|