pgit 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,54 @@
1
+ require 'pgit'
2
+
3
+ describe 'PGit::Story' do
4
+ describe '#get' do
5
+ it 'should generate the story' do
6
+ story_id = '123'
7
+ current_project = double('current_project', id: '321', api_token: 'abc10xyz')
8
+ get_request = "curl -X GET -H 'X-TrackerToken: abc10xyz' 'https://www.pivotaltracker.com/services/v5/projects/321/stories/123'"
9
+ fake_good_json = <<-GOOD_JSON
10
+ {
11
+ "created_at": "2014-11-25T12:00:00Z",
12
+ "current_state": "unstarted",
13
+ "description": "ignore the droids",
14
+ "estimate": 2,
15
+ "id": 555,
16
+ "kind": "story",
17
+ "labels": [],
18
+ "name": "Bring me the passengers",
19
+ "owner_ids": [],
20
+ "project_id": 99,
21
+ "requested_by_id": 101,
22
+ "story_type": "feature",
23
+ "updated_at": "2014-11-25T12:00:00Z",
24
+ "url": "http://localhost/story/show/555"
25
+ }
26
+ GOOD_JSON
27
+ allow(PGit::Story).to receive(:`).with(get_request).and_return(fake_good_json)
28
+
29
+ story = PGit::Story.get(story_id, current_project)
30
+
31
+ expect(story.name).to eq "Bring me the passengers"
32
+ expect(story.description).to eq "ignore the droids"
33
+ end
34
+
35
+ describe 'if there is an error' do
36
+ it 'should raise an error' do
37
+ story_id = '123'
38
+ current_project = double('current_project', id: '321', api_token: 'abc10xyz')
39
+ get_request = "curl -X GET -H 'X-TrackerToken: abc10xyz' 'https://www.pivotaltracker.com/services/v5/projects/321/stories/123'"
40
+ fake_json_str_with_error = <<-ERROR_JSON
41
+ {
42
+ "code": "unfound_resource",
43
+ "kind": "error",
44
+ "error": "The object you tried to access could not be found. It may have been removed by another user, you may be using the ID of another object type, or you may be trying to access a sub-resource at the wrong point in a tree."
45
+ }
46
+ ERROR_JSON
47
+
48
+ allow(PGit::Story).to receive(:`).with(get_request).and_return(fake_json_str_with_error)
49
+
50
+ expect{ PGit::Story.get(story_id, current_project) }.to raise_error(fake_json_str_with_error)
51
+ end
52
+ end
53
+ end
54
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pgit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Edderic Ugaddan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: gli
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 2.12.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 2.12.2
41
+ description:
42
+ email: edderic@gmail.com
43
+ executables:
44
+ - pgit
45
+ extensions: []
46
+ extra_rdoc_files:
47
+ - README.markdown
48
+ files:
49
+ - ".gitignore"
50
+ - ".rspec"
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - LICENSE
54
+ - README.markdown
55
+ - Rakefile
56
+ - bin/pgit
57
+ - lib/pgit.rb
58
+ - lib/pgit/configuration.rb
59
+ - lib/pgit/current_branch.rb
60
+ - lib/pgit/current_project.rb
61
+ - lib/pgit/installer.rb
62
+ - lib/pgit/name_parser.rb
63
+ - lib/pgit/story.rb
64
+ - lib/pgit/story_branch.rb
65
+ - lib/pgit/story_branch/application.rb
66
+ - lib/pgit/version.rb
67
+ - lib/pgit_configuration.rb
68
+ - man/pgit.1
69
+ - man/pgit.1.html
70
+ - man/pgit.1.ronn
71
+ - pgit.gemspec
72
+ - pgit.rdoc
73
+ - spec/pgit/application_spec.rb
74
+ - spec/pgit/configuration_spec.rb
75
+ - spec/pgit/current_branch_spec.rb
76
+ - spec/pgit/current_project_spec.rb
77
+ - spec/pgit/installer_spec.rb
78
+ - spec/pgit/pgit_spec.rb
79
+ - spec/pgit/story_branch/application_spec.rb
80
+ - spec/pgit/story_branch/name_parser_spec.rb
81
+ - spec/pgit/story_branch_spec.rb
82
+ - spec/pgit/story_spec.rb
83
+ homepage: http://edderic.github.io
84
+ licenses: []
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options:
88
+ - "--title"
89
+ - pgit
90
+ - "--main"
91
+ require_paths:
92
+ - lib
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.2.2
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Optimize your Pivotal Tracker and Github workflow
110
+ test_files: []