jira-slurper 1.3.1

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.
@@ -0,0 +1,57 @@
1
+ require 'rubygems'
2
+ require 'slurper'
3
+ require 'pivotal'
4
+
5
+ describe Pivotal do
6
+
7
+ before do
8
+ @tracker = Pivotal.new
9
+ end
10
+
11
+ describe '#supports?' do
12
+ it 'should support pivotal if project_id exists' do
13
+ @tracker.supports?({'project_id' => 12345}).should be_true
14
+ end
15
+
16
+ it 'should support pivotal if specified' do
17
+ @tracker.supports?({'tracker' => 'pivotal'}).should be_true
18
+ end
19
+ end
20
+
21
+ end
22
+
23
+ #describe Story do
24
+ #
25
+ # before do
26
+ # fixture = File.join(File.dirname(__FILE__), "fixtures", "slurper_config_pivotal.yml")
27
+ # Story.configure(YAML.load_file fixture)
28
+ # end
29
+ #
30
+ # context "#prepare" do
31
+ #
32
+ # it "uses http by default" do
33
+ # Story.scheme.should == "http"
34
+ # Story.config['ssl'].should be_nil
35
+ # end
36
+ #
37
+ # it "uses https if set in the config" do
38
+ # Story.configure({"ssl" => true})
39
+ #
40
+ # Story.config['ssl'].should be_true
41
+ # Story.scheme.should == "https"
42
+ # Story.ssl_options[:verify_mode].should == 1
43
+ #
44
+ # # Not sure what this next line is testing
45
+ # File.open(File.expand_path('lib/cacert.pem')).readlines.find_all{ |l| l.starts_with?("Equifax") }.count.should == 4
46
+ # end
47
+ #
48
+ # it "sets the api token from config" do
49
+ # Story.headers.should == {"X-TrackerToken"=>"123abc123abc123abc123abc"}
50
+ # end
51
+ # end
52
+ #
53
+ #
54
+ #
55
+ #
56
+ #
57
+ #end
@@ -0,0 +1,135 @@
1
+ require 'rubygems'
2
+ require 'slurper'
3
+
4
+ describe Slurper do
5
+
6
+ context "#create_stories" do
7
+ let(:stories) { [YamlStory.new(:name => 'A story')] }
8
+ let(:config) { {:tracker => 'jira'} }
9
+ let(:slurper) { Slurper.new(config, stories) }
10
+ let(:handler) { double('handler') }
11
+
12
+ before do
13
+ slurper.handlers = [handler]
14
+ end
15
+
16
+ it 'should error out if no handler can create the stories' do
17
+ slurper.handlers = []
18
+ expect { slurper.create_stories }.to raise_error
19
+ end
20
+
21
+ it "should detect the handler by checking the config" do
22
+ handler.should_receive(:supports?).with(config).and_return(true)
23
+ handler.should_receive(:configure!).and_return(true)
24
+ handler.should_receive(:handle)
25
+
26
+ slurper.create_stories
27
+ end
28
+
29
+ it "should call configure on the handler" do
30
+ handler.should_receive(:supports?).with(config).and_return(true)
31
+ handler.should_receive(:configure!).with(config)
32
+
33
+ slurper.create_stories
34
+ end
35
+
36
+ it "should delegate to the proper handler" do
37
+ jira = double
38
+ jira.should_receive(:supports?).with(config).and_return(false)
39
+
40
+ pivotal = double
41
+ pivotal.should_receive(:supports?).with(config).and_return(true)
42
+ pivotal.should_receive(:configure!).and_return(true)
43
+ pivotal.should_receive(:handle).with(stories[0])
44
+
45
+ slurper.handlers = [jira, pivotal]
46
+ slurper.create_stories
47
+ end
48
+
49
+ it "should fail gracefully on handler exceptions" do
50
+ handler.stub(:supports?).and_return(true)
51
+ handler.should_receive(:configure!).and_return(true)
52
+ handler.stub(:handle).and_raise('An error')
53
+
54
+ expect { slurper.create_stories }.not_to raise_error
55
+ end
56
+ end
57
+
58
+ context "Slurper#slurp" do
59
+ it "should delegate one story to a handler" do
60
+ story_file = File.join(File.dirname(__FILE__), "fixtures", "full_story.slurper")
61
+ config_file = File.join(File.dirname(__FILE__), "fixtures", "slurper_config_pivotal.yml")
62
+
63
+ handler = double
64
+ handler.stub(:supports?).and_return true
65
+ handler.stub(:configure!).and_return true
66
+ handler.should_receive(:handle).once()
67
+
68
+ Slurper.slurp(story_file, config_file, [handler], false)
69
+ end
70
+ end
71
+
72
+ describe "#load_stories" do
73
+ let(:file) { File.join(File.dirname(__FILE__), "fixtures", story_file) }
74
+ let(:config) { {} }
75
+ let(:stories) { Slurper.load_stories(file, config) }
76
+ let(:story) { stories.first }
77
+
78
+ context "default values" do
79
+ let(:story_file) { 'whitespacey_story.slurper' }
80
+ let(:config) { {'requested_by' => 'John Doe'} }
81
+
82
+ it 'should load default values' do
83
+ story.requested_by.should == 'John Doe'
84
+ end
85
+ end
86
+
87
+ context "deals with leading/trailing whitespace" do
88
+ let(:story_file) { 'whitespacey_story.slurper' }
89
+
90
+ it "strips whitespace from the name" do
91
+ story.name.should == "Profit"
92
+ end
93
+ end
94
+
95
+ context "given values for all attributes" do
96
+ let(:story_file) { 'full_story.slurper' }
97
+
98
+ it "parses the name correctly" do
99
+ story.name.should == 'Profit'
100
+ end
101
+
102
+ it "parses the label correctly" do
103
+ story.labels.should == ['money','power','fame']
104
+ end
105
+
106
+ it "parses the story type correctly" do
107
+ story.story_type.should == 'feature'
108
+ end
109
+ end
110
+
111
+ context "given only a name" do
112
+ let(:story) { stories.first }
113
+ let(:story_file) { 'name_only.slurper' }
114
+
115
+ it "should parse the name correctly" do
116
+ story.name.should == "Profit"
117
+ end
118
+
119
+ end
120
+
121
+ context "given empty attributes" do
122
+ let(:story) { stories.first }
123
+ let(:story_file) { 'empty_attributes.slurper' }
124
+
125
+ it "should not set any name" do
126
+ story.name.should be_nil
127
+ end
128
+
129
+ it "should not set any labels" do
130
+ story.labels.should == []
131
+ end
132
+ end
133
+ end
134
+
135
+ end
@@ -0,0 +1,82 @@
1
+ require 'rubygems'
2
+ require 'story'
3
+
4
+ describe YamlStory do
5
+ context "#new" do
6
+ it "should return a default value if it's set" do
7
+ story = YamlStory.new({}, 'description' => 'Fill description', 'requested_by' => 'John Doe')
8
+
9
+ story.description.should == 'Fill description'
10
+ story.requested_by.should == 'John Doe'
11
+ end
12
+ end
13
+
14
+ context "#requested_by" do
15
+ it "should return nil when value is blank" do
16
+ story = YamlStory.new('requested_by' => '')
17
+ story.requested_by.should be_nil
18
+ end
19
+
20
+ end
21
+
22
+ context "#description" do
23
+ it "when the description is blank" do
24
+ story = YamlStory.new('description' => '', 'name' => 'test')
25
+ story.description.should be_nil
26
+ end
27
+
28
+ it "when there is no description given" do
29
+ story = YamlStory.new
30
+ story.description.should be_nil
31
+ end
32
+
33
+ it "when it contains quotes" do
34
+ desc = <<-STRING
35
+ I have a "quote"
36
+ STRING
37
+ story = YamlStory.new('description' => desc)
38
+ story.description.should == "I have a \"quote\"\n"
39
+ end
40
+
41
+ it "when it is full of whitespace" do
42
+ desc = <<-STRING
43
+ In order to do something
44
+ As a role
45
+ I want to click a thingy
46
+ STRING
47
+ story = YamlStory.new('description' => desc)
48
+ story.description.should == "In order to do something\nAs a role\nI want to click a thingy\n"
49
+ end
50
+
51
+ it "when it contains acceptance criteria" do
52
+ desc = <<-STRING
53
+ In order to do something
54
+ As a role
55
+ I want to click a thingy
56
+
57
+ Acceptance:
58
+ - do the thing
59
+ - don't forget the other thing
60
+ STRING
61
+ story = YamlStory.new('description' => desc)
62
+ story.description.should == "In order to do something\nAs a role\nI want to click a thingy\n\nAcceptance:\n- do the thing\n- don't forget the other thing\n"
63
+ end
64
+ end
65
+
66
+ context 'default attributes' do
67
+ it 'uses the default if not given one' do
68
+ story = YamlStory.new({}, {'requested_by' => 'Mr. Client'})
69
+ story.requested_by.should == 'Mr. Client'
70
+ end
71
+
72
+ it 'uses the default if given a blank requested_by' do
73
+ story = YamlStory.new({'requested_by' => ''}, {'requested_by' => 'Mr. Client'})
74
+ story.requested_by.should == 'Mr. Client'
75
+ end
76
+
77
+ it 'uses the name given in the story file if there is one' do
78
+ story = YamlStory.new({'requested_by' => 'Mr. Stakeholder'}, {'requested_by' => 'Mr. Client'})
79
+ story.requested_by.should == 'Mr. Stakeholder'
80
+ end
81
+ end
82
+ end
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jira-slurper
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.1
5
+ platform: ruby
6
+ authors:
7
+ - Wes Gibbs
8
+ - Adam Lowe
9
+ - Stephen Caudill
10
+ - Tim Pope
11
+ - Catalin Costache
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+ date: 2014-07-07 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: faraday
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 0.8.8
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 0.8.8
31
+ - !ruby/object:Gem::Dependency
32
+ name: configliere
33
+ requirement: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.4.8
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 0.4.8
45
+ - !ruby/object:Gem::Dependency
46
+ name: json
47
+ requirement: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ~>
50
+ - !ruby/object:Gem::Version
51
+ version: 1.7.7
52
+ type: :runtime
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ version: 1.7.7
59
+ - !ruby/object:Gem::Dependency
60
+ name: rspec
61
+ requirement: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 2.14.0
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ version: 2.14.0
73
+ description: "\n Slurps stories from the given file (stories.slurper by default)
74
+ and creates Pivotal Tracker stories from them. Useful during story carding sessions
75
+ when you want to capture a number of stories quickly without clicking your way through
76
+ the Tracker UI.\n "
77
+ email: dev@hashrocket.com
78
+ executables:
79
+ - slurp
80
+ extensions: []
81
+ extra_rdoc_files:
82
+ - README.rdoc
83
+ files:
84
+ - README.rdoc
85
+ - bin/slurp
86
+ - lib/cacert.pem
87
+ - lib/jira.rb
88
+ - lib/pivotal.rb
89
+ - lib/slurper.rb
90
+ - lib/story.rb
91
+ - spec/jira_spec.rb
92
+ - spec/pivotal_spec.rb
93
+ - spec/slurper_spec.rb
94
+ - spec/story_spec.rb
95
+ homepage: http://github.com/hashrocket/slurper
96
+ licenses: []
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options:
100
+ - --charset=UTF-8
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - '>='
111
+ - !ruby/object:Gem::Version
112
+ version: 1.3.6
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.3.0
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: takes a formatted story file and puts it on Pivotal / Jira Tracker
119
+ test_files:
120
+ - spec/jira_spec.rb
121
+ - spec/pivotal_spec.rb
122
+ - spec/slurper_spec.rb
123
+ - spec/story_spec.rb