startling_pivotal 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1672460b0f4231f8f2bd3eb98250e55d618a299
4
- data.tar.gz: 25089e3865b0215ee989eb8de16f3a1eef98f8d9
3
+ metadata.gz: 34bc70ebe53cd3db04a5cefc91f1b7208db251e7
4
+ data.tar.gz: 47240c9cf39f8a4a65ea36736690ad3f0111f7b1
5
5
  SHA512:
6
- metadata.gz: 63f4aa55ff3045066248de66c4f5be1c6981170b81697a8638b20186d2c7327a8bcc99acefa58c6fc869d9a4c4653668df8695dffe57f449b3e2c79ec566bfc0
7
- data.tar.gz: 9b59b5249c14fba4385addf926614a490003f0be56add85faa403bd56523c1429e2d68edf98eff142abf09bcd6ad179bf4333a1bb2e3cdbae67d0ed4b1c63f72
6
+ metadata.gz: 2a15202fea440faaeaab24f48912e7ffb0837db24a9ea0395c5b3ba75cdf7f7d19c368ed58c3c1e044d3e76a0a0a1826bd84825fec9f80b7ff07ff7131a8e060
7
+ data.tar.gz: d9ac189151d4f8807c7f48d602e576472f7bfbe6c48bacef2272ce1567d25623ffa25062e0a106f68a21b84602ec15bed519eddbaee662ad18ed2bc255d49abf
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at startling@substantial.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/README.md CHANGED
@@ -20,25 +20,15 @@ Or install it yourself as:
20
20
 
21
21
  Generate configuration file in Rails:
22
22
 
23
- $ rails g startling:configuration
24
23
  $ rails g startling_pivotal:configuration
25
24
 
26
25
  ## Configuration
27
26
 
28
- ### Startling Pivotal Configuration
29
-
30
- startling_pivotal_file.rb should be defined at the root of the project. It can
31
- contain a block for configuration:
32
-
33
- ```ruby
34
- StartlingPivotal.configure do |config|
35
- # Valid story estimations
36
- # config.valid_estimates = [1, 2, 3]
37
- end
38
- ```
39
-
40
27
  ### Startling Configuration
41
28
 
29
+ startlingfile.rb or Startlingfile.rb should be defined at the root of the
30
+ project. It can contain a block for configuration.
31
+
42
32
  Add the following line to the beginning of the Startling configuration file:
43
33
 
44
34
  ```ruby
@@ -48,7 +38,20 @@ require 'startling_pivotal'
48
38
  Add or update the following line of the Startling configuration file:
49
39
 
50
40
  ```ruby
51
- config.story_handler = :pivotal_start
41
+ Startling.configure do |config|
42
+ config.story_handler = :pivotal_start
43
+ end
44
+ ```
45
+
46
+ ### Startling Pivotal Configuration
47
+
48
+ The following configuration values can be set:
49
+
50
+ ```ruby
51
+ Startling.configure do |config|
52
+ # Valid story estimations
53
+ # config.valid_estimates = [1, 2, 3]
54
+ end
52
55
  ```
53
56
 
54
57
  ## Usage
@@ -65,13 +68,27 @@ Check story status:
65
68
 
66
69
  $ story_status 12345
67
70
 
71
+ ## Development
72
+
73
+ After checking out the repo, run `cd startling/startling_pivotal && bin/setup`
74
+ to install dependencies. Create `.env` from the Secure Note `startling_pivotal
75
+ .env` in LastPass. Then, run `rake spec` to run the tests. You can also run
76
+ `bin/console` for an interactive prompt that will allow you to experiment.
77
+
78
+ To install this gem onto your local machine, run `bundle exec rake install`.
79
+ To release a new version, update the version number in `version.rb`, and then
80
+ run `bundle exec rake release`, which will create a git tag for the version,
81
+ push git commits and tags, and push the `.gem` file to
82
+ [rubygems.org](https://rubygems.org).
83
+
68
84
  ## Contributing
69
85
 
70
- 1. Create `.env` from the Secure Note `startling .env` in
71
- LastPass.
72
- 1. `gem install bundler`
73
- 1. `bundle install`
86
+ Bug reports and pull requests are welcome on GitHub at
87
+ https://github.com/substantial/startling. This project is intended to be a safe,
88
+ welcoming space for collaboration, and contributors are expected to adhere to
89
+ the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
74
90
 
75
- ### Running tests
91
+ ## License
76
92
 
77
- `rake`
93
+ The gem is available as open source under the terms of the
94
+ [MIT License](http://opensource.org/licenses/MIT).
data/bin/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "startling_pivotal"
5
+
6
+ require "pry"
7
+ Pry.start
8
+
9
+ require "irb"
10
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
File without changes
@@ -6,28 +6,28 @@ module StartlingPivotal
6
6
  module Generators
7
7
  class ConfigurationGenerator < Rails::Generators::Base
8
8
  def create_config_file
9
- create_file "startling_pivotal_file.rb" do
9
+ generate 'startling:configuration'
10
+
11
+ file_name = Startling::Configuration::DEFAULT_STARTLINGFILES[0]
12
+
13
+ inject_into_file file_name, before: 'Startling.configure do |config|' do
10
14
  <<CONFIG
11
- StartlingPivotal.configure do |config|
12
- # Valid story estimations
13
- # config.valid_estimates = [1, 2, 3]
14
- end
15
+ require 'startling_pivotal'
16
+
15
17
  CONFIG
16
18
  end
17
19
 
18
- Startling::Configuration::DEFAULT_STARTLINGFILES.each do |file_name|
19
- if Dir.entries(Startling::GitLocal.new.project_root).include? file_name
20
- inject_into_file file_name, before: 'Startling.configure do |config|' do
20
+ gsub_file file_name,
21
+ '# config.story_handler = :pivotal_start',
22
+ 'config.story_handler = :pivotal_start'
23
+
24
+ inject_into_file file_name, after: 'config.story_handler = :pivotal_start' do
21
25
  <<CONFIG
22
- require 'startling_pivotal'
23
26
 
24
- CONFIG
25
- end
26
27
 
27
- gsub_file file_name,
28
- '# config.story_handler = :pivotal_start',
29
- 'config.story_handler = :pivotal_start'
30
- end
28
+ # Valid story estimations
29
+ # config.valid_estimates = [1, 2, 3]
30
+ CONFIG
31
31
  end
32
32
  end
33
33
  end
@@ -18,12 +18,12 @@ module StartlingPivotal
18
18
  end
19
19
 
20
20
  def story(id)
21
- get("stories/#{id}")
21
+ get("stories/#{strip_id(id)}")
22
22
  end
23
23
 
24
24
  def update_story(id, attrs)
25
25
  response = connection.put do |request|
26
- request.url "stories/#{id}"
26
+ request.url "stories/#{strip_id(id)}"
27
27
  request.headers["Content-Type"] = "application/json"
28
28
  request.headers["X-TrackerToken"] = api_token
29
29
  request.body = attrs.to_json
@@ -52,6 +52,10 @@ module StartlingPivotal
52
52
  Api.parse_response response
53
53
  end
54
54
 
55
+ def strip_id(id)
56
+ id.gsub(/[^0-9]/, '')
57
+ end
58
+
55
59
  def self.parse_response(response)
56
60
  verify_response response
57
61
  JSON.parse response.body
@@ -1,11 +1,12 @@
1
1
  require 'startling'
2
+ require 'highline/import'
2
3
  require_relative '../../startling_pivotal'
3
4
 
4
5
  module Startling
5
6
  module Commands
6
7
  class PivotalStart < Base
7
8
  def execute
8
- StartlingPivotal::Configuration.load_configuration
9
+ Startling::Configuration.load_configuration
9
10
 
10
11
  logger.info "Starting story..."
11
12
  estimate = ask_for_estimate unless story.estimated?
@@ -21,7 +22,7 @@ module Startling
21
22
  estimate = ask("Enter estimate (#{valid_estimates.join(", ")}): ")
22
23
  estimate = Integer(estimate)
23
24
  raise 'Invalid estimate' unless valid_estimates.include? estimate
24
- return estimate.to_i
25
+ return estimate
25
26
  rescue => e
26
27
  puts e.message
27
28
  retry
@@ -33,11 +34,19 @@ module Startling
33
34
  end
34
35
 
35
36
  def get_story_id
36
- @story_id ||= prompt_for_story_id
37
+ if story_id
38
+ story_id
39
+ elsif args.length > 0
40
+ args[0]
41
+ else
42
+ prompt_for_story_id
43
+ end
37
44
  end
38
45
 
46
+ private
47
+
39
48
  def prompt_for_story_id
40
- result = ask("Enter story id to start: ").gsub(/[^0-9]/, '')
49
+ result = ask("Enter story id to start: ")
41
50
  abort "Pivotal id must be specified." if result.empty?
42
51
  result
43
52
  end
@@ -1,3 +1,3 @@
1
1
  module StartlingPivotal
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,26 +1,16 @@
1
+ require 'startling'
1
2
  require_relative 'startling_pivotal/api'
2
- require_relative 'startling_pivotal/configuration'
3
3
  require_relative 'startling_pivotal/helper'
4
4
  require_relative 'startling_pivotal/story'
5
5
  require_relative 'startling_pivotal/commands/pivotal_start'
6
6
 
7
7
  module StartlingPivotal
8
8
  class << self
9
- attr_writer :configuration
10
-
11
9
  def method_missing(method, *args, &block)
12
- configuration.send(method, *args, &block)
10
+ Startling.send(method, *args, &block)
13
11
  end
14
12
  end
15
13
 
16
- def self.configuration
17
- @configuration ||= Configuration.new
18
- end
19
-
20
- def self.configure
21
- yield(configuration)
22
- end
23
-
24
14
  def self.api
25
15
  @api ||= Api.new(api_token: Helper.new.api_token)
26
16
  end
@@ -7,25 +7,26 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "startling_pivotal"
8
8
  spec.version = StartlingPivotal::VERSION
9
9
  spec.authors = ["Jeff Forde", "Cassie Koomjian"]
10
- spec.email = ["tchdevs@substantial.com"]
11
- spec.description = %q{Startling Pivotal Api}
12
- spec.summary = %q{Startling Pivotal Api}
10
+ spec.email = ["startling@substantial.com"]
11
+ spec.summary = %q{Startling Pivotal Integration}
13
12
  spec.homepage = ""
14
13
  spec.license = "MIT"
15
14
 
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
18
  spec.require_paths = ["lib"]
20
19
 
21
- spec.add_development_dependency "bundler"
22
- spec.add_development_dependency "rake"
20
+ spec.add_development_dependency "bundler", "~> 1.11"
21
+ spec.add_development_dependency "rake", "~> 10.0"
23
22
  spec.add_development_dependency "rspec", "~> 3.2"
24
- spec.add_development_dependency "pry"
25
- spec.add_development_dependency "webmock", "~> 1.20"
26
- spec.add_development_dependency "excon"
27
- spec.add_development_dependency "dotenv"
23
+ spec.add_development_dependency "pry", "~> 0.10"
28
24
  spec.add_development_dependency "vcr", "~> 2.9"
25
+ spec.add_development_dependency "webmock", "~> 1.20"
26
+ spec.add_development_dependency "excon", "~> 0.45"
27
+ spec.add_development_dependency "dotenv", "~> 2.1"
28
+
29
29
  spec.add_dependency "startling", "~> 0.0.9"
30
30
  spec.add_dependency "faraday", "~> 0.9"
31
+ spec.add_dependency "highline", "~> 1.6"
31
32
  end
metadata CHANGED
@@ -1,44 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: startling_pivotal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Forde
8
8
  - Cassie Koomjian
9
9
  autorequire:
10
- bindir: bin
10
+ bindir: exe
11
11
  cert_chain: []
12
- date: 2016-02-23 00:00:00.000000000 Z
12
+ date: 2016-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: '1.11'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: '1.11'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0'
34
+ version: '10.0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0'
41
+ version: '10.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -57,72 +57,72 @@ dependencies:
57
57
  name: pry
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ">="
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '0'
62
+ version: '0.10'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ">="
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: '0.10'
70
70
  - !ruby/object:Gem::Dependency
71
- name: webmock
71
+ name: vcr
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '1.20'
76
+ version: '2.9'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '1.20'
83
+ version: '2.9'
84
84
  - !ruby/object:Gem::Dependency
85
- name: excon
85
+ name: webmock
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ">="
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '0'
90
+ version: '1.20'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ">="
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '0'
97
+ version: '1.20'
98
98
  - !ruby/object:Gem::Dependency
99
- name: dotenv
99
+ name: excon
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ">="
102
+ - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: '0'
104
+ version: '0.45'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ">="
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '0'
111
+ version: '0.45'
112
112
  - !ruby/object:Gem::Dependency
113
- name: vcr
113
+ name: dotenv
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '2.9'
118
+ version: '2.1'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '2.9'
125
+ version: '2.1'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: startling
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -151,38 +151,44 @@ dependencies:
151
151
  - - "~>"
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0.9'
154
- description: Startling Pivotal Api
154
+ - !ruby/object:Gem::Dependency
155
+ name: highline
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '1.6'
161
+ type: :runtime
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '1.6'
168
+ description:
155
169
  email:
156
- - tchdevs@substantial.com
170
+ - startling@substantial.com
157
171
  executables:
158
172
  - story_status
159
173
  extensions: []
160
174
  extra_rdoc_files: []
161
175
  files:
162
176
  - ".ruby-gemset"
177
+ - CODE_OF_CONDUCT.md
163
178
  - Gemfile
164
179
  - LICENSE.txt
165
180
  - README.md
166
181
  - Rakefile
167
- - bin/story_status
182
+ - bin/console
183
+ - bin/setup
184
+ - exe/story_status
168
185
  - lib/generators/startling_pivotal/configuration_generator.rb
169
186
  - lib/startling_pivotal.rb
170
187
  - lib/startling_pivotal/api.rb
171
188
  - lib/startling_pivotal/commands/pivotal_start.rb
172
- - lib/startling_pivotal/configuration.rb
173
189
  - lib/startling_pivotal/helper.rb
174
190
  - lib/startling_pivotal/story.rb
175
191
  - lib/startling_pivotal/version.rb
176
- - spec/spec_helper.rb
177
- - spec/startling_pivotal/api_spec.rb
178
- - spec/startling_pivotal/configuration_spec.rb
179
- - spec/support/dotenv.rb
180
- - spec/support/tokens.rb
181
- - spec/support/vcr.rb
182
- - spec/vcr_cassettes/pivotal_tracker_api_api_token.yml
183
- - spec/vcr_cassettes/pivotal_tracker_api_story.yml
184
- - spec/vcr_cassettes/pivotal_tracker_api_update_story.yml
185
- - spec/vcr_cassettes/pivotal_tracker_api_user_id.yml
186
192
  - startling_pivotal.gemspec
187
193
  homepage: ''
188
194
  licenses:
@@ -207,15 +213,5 @@ rubyforge_project:
207
213
  rubygems_version: 2.5.1
208
214
  signing_key:
209
215
  specification_version: 4
210
- summary: Startling Pivotal Api
211
- test_files:
212
- - spec/spec_helper.rb
213
- - spec/startling_pivotal/api_spec.rb
214
- - spec/startling_pivotal/configuration_spec.rb
215
- - spec/support/dotenv.rb
216
- - spec/support/tokens.rb
217
- - spec/support/vcr.rb
218
- - spec/vcr_cassettes/pivotal_tracker_api_api_token.yml
219
- - spec/vcr_cassettes/pivotal_tracker_api_story.yml
220
- - spec/vcr_cassettes/pivotal_tracker_api_update_story.yml
221
- - spec/vcr_cassettes/pivotal_tracker_api_user_id.yml
216
+ summary: Startling Pivotal Integration
217
+ test_files: []
@@ -1,23 +0,0 @@
1
- module StartlingPivotal
2
- class Configuration
3
- DEFAULT_VALID_ESTIMATES = [1, 2, 3]
4
- DEFAULT_CONFIG_FILE = 'startling_pivotal_file.rb'
5
-
6
- attr_accessor :valid_estimates
7
-
8
- def initialize
9
- @valid_estimates = DEFAULT_VALID_ESTIMATES
10
- end
11
-
12
- def self.load_configuration
13
- file_name = DEFAULT_CONFIG_FILE
14
-
15
- if Dir.entries(Startling::GitLocal.new.project_root).include? file_name
16
- load "#{Startling::GitLocal.new.project_root}/#{file_name}"
17
- return file_name
18
- end
19
-
20
- nil
21
- end
22
- end
23
- end
data/spec/spec_helper.rb DELETED
@@ -1,19 +0,0 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # Require this file using `require "spec_helper"` to ensure that it is only
4
- # loaded once.
5
- #
6
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
- RSpec.configure do |config|
8
- config.run_all_when_everything_filtered = true
9
- config.filter_run :focus
10
-
11
- # Run specs in random order to surface order dependencies. If you find an
12
- # order dependency and want to debug it, you can fix the order by providing
13
- # the seed, which is printed after each run.
14
- # --seed 1234
15
- config.order = 'random'
16
- end
17
-
18
- require 'pry'
19
- Dir['./spec/support/**/*.rb'].map {|f| require f}
@@ -1,46 +0,0 @@
1
- require 'spec_helper'
2
- require 'startling_pivotal/api'
3
-
4
- module StartlingPivotal
5
- describe Api do
6
- let(:api_token) { Tokens.pivotal_tracker }
7
- let(:api) { Api.new(api_token: api_token) }
8
-
9
- specify "#user_id should return the id of the current user",
10
- vcr: { cassette_name: "pivotal_tracker_api_user_id" } do
11
- expect(api.user_id).to eq(1240260)
12
- end
13
-
14
- specify ".api_token should return the api_token of the user",
15
- vcr: { cassette_name: "pivotal_tracker_api_api_token" } do
16
- token = Api.api_token_for_user "aaron+tchtesting@substantial.com", "asdfasdf"
17
- expect(token).to eq(api_token)
18
- end
19
-
20
- # Uses https://www.pivotaltracker.com/story/show/65069954
21
- #
22
- # Preconditions:
23
- # Name should match tested name.
24
- specify "#story should return story details",
25
- vcr: { cassette_name: "pivotal_tracker_api_story" } do
26
- story = api.story(65069954)
27
- expect(story["name"]).to eq("TEST: pivotal_tracker_api_story")
28
- end
29
-
30
- # Uses https://www.pivotaltracker.com/story/show/65072638
31
- #
32
- # Preconditions:
33
- # Story should not have an estimate
34
- specify "#update_story should update the story",
35
- vcr: { cassette_name: "pivotal_tracker_api_update_story" } do
36
- story_id = 65072638
37
- story = api.story(story_id)
38
- expect(story["estimate"]).to be_nil
39
-
40
- api.update_story story_id, estimate: 8
41
-
42
- story = api.story(story_id)
43
- expect(story["estimate"]).to eq(8)
44
- end
45
- end
46
- end
@@ -1,57 +0,0 @@
1
- require 'spec_helper'
2
- require 'startling'
3
- require 'startling_pivotal/configuration'
4
-
5
- module StartlingPivotal
6
- describe Configuration do
7
- let(:configuration) { Configuration.new }
8
-
9
- describe 'Default settings' do
10
- it 'sets the default valid estimates' do
11
- expect(configuration.valid_estimates).to eql(Configuration::DEFAULT_VALID_ESTIMATES)
12
- end
13
- end
14
-
15
- describe "#valid_estimates" do
16
- it "can set the value" do
17
- configuration.valid_estimates = [1, 2]
18
- expect(configuration.valid_estimates).to eql([1, 2])
19
- end
20
- end
21
-
22
- describe "#load_configuration" do
23
- let(:git) { double(Startling::GitLocal) }
24
- let(:config_file) { "startling_pivotal_file.rb" }
25
-
26
- before do
27
- allow(Startling::GitLocal).to receive(:new) { git }
28
- allow(git).to receive(:project_root) { Dir.pwd }
29
- end
30
-
31
- after do
32
- delete_config_file(config_file)
33
- end
34
-
35
- context "when no configuration file exists" do
36
- it "uses default configuration" do
37
- expect(Configuration.load_configuration).to eql(nil)
38
- end
39
- end
40
-
41
- context "when a configuration file exists" do
42
- it "loads configuration from startling_pivotal_file.rb" do
43
- create_config_file(config_file)
44
- expect(Configuration.load_configuration).to eql(config_file)
45
- end
46
- end
47
- end
48
-
49
- def create_config_file(config_file)
50
- File.open(config_file, "w")
51
- end
52
-
53
- def delete_config_file(config_file)
54
- File.delete(config_file) if File.exists? config_file
55
- end
56
- end
57
- end
@@ -1,2 +0,0 @@
1
- require 'dotenv'
2
- Dotenv.load
@@ -1,5 +0,0 @@
1
- module Tokens
2
- def self.pivotal_tracker
3
- ENV.fetch("TEST_PIVOTAL_TRACKER_API_TOKEN") { raise "Copy startling .env from LastPass into .env" }
4
- end
5
- end
data/spec/support/vcr.rb DELETED
@@ -1,13 +0,0 @@
1
- require 'vcr'
2
-
3
- VCR.configure do |config|
4
- config.cassette_library_dir = 'spec/vcr_cassettes'
5
- config.hook_into :webmock
6
- config.default_cassette_options = {
7
- allow_unused_http_interactions: false
8
- }
9
- config.filter_sensitive_data '<PIVOTAL_API_TOKEN>' do
10
- ENV.fetch "TEST_PIVOTAL_TRACKER_API_TOKEN"
11
- end
12
- config.configure_rspec_metadata!
13
- end
@@ -1,77 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://aaron%2Btchtesting%40substantial.com:asdfasdf@www.pivotaltracker.com/services/v5/me
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.9.0
12
- Accept-Encoding:
13
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
- Accept:
15
- - '*/*'
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Content-Type:
22
- - application/json; charset=utf-8
23
- Transfer-Encoding:
24
- - chunked
25
- Status:
26
- - '200'
27
- X-Powered-By:
28
- - Phusion Passenger (mod_rails/mod_rack) 3.0.14
29
- X-Runtime:
30
- - '124'
31
- Cache-Control:
32
- - private, max-age=0, must-revalidate
33
- Etag:
34
- - '"6fe95f24a6cf270b0dba00df7f0cf5ea"'
35
- Server:
36
- - nginx/1.2.2 + Phusion Passenger 3.0.14 (mod_rails/mod_rack)
37
- Access-Control-Allow-Origin:
38
- - '*'
39
- Access-Control-Allow-Credentials:
40
- - 'false'
41
- Access-Control-Allow-Methods:
42
- - GET, POST, PUT, DELETE, OPTIONS
43
- Access-Control-Allow-Headers:
44
- - X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is
45
- body:
46
- encoding: UTF-8
47
- string: |-
48
- {
49
- "projects": [
50
- {
51
- "role": "owner",
52
- "project_name": "Tch Start Testing",
53
- "project_color": "e46642",
54
- "last_viewed_at": "2014-02-04T16:39:33Z",
55
- "id": 3907566,
56
- "project_id": 1007746,
57
- "kind": "membership_summary"
58
- }
59
- ],
60
- "has_google_identity": false,
61
- "email": "aaron+tchtesting@substantial.com",
62
- "initials": "TT",
63
- "name": "Tch Testing",
64
- "time_zone": {
65
- "offset": "-07:00",
66
- "olson_name": "America/Los_Angeles",
67
- "kind": "time_zone"
68
- },
69
- "id": 1240260,
70
- "kind": "me",
71
- "username": "tcht",
72
- "api_token": "<PIVOTAL_API_TOKEN>",
73
- "receives_in_app_notifications": true
74
- }
75
- http_version:
76
- recorded_at: Fri, 11 Apr 2014 17:17:43 GMT
77
- recorded_with: VCR 2.8.0
@@ -1,73 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://www.pivotaltracker.com/services/v5/stories/65069954
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.9.0
12
- X-Trackertoken:
13
- - <PIVOTAL_API_TOKEN>
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - '*/*'
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Content-Type:
24
- - application/json; charset=utf-8
25
- Transfer-Encoding:
26
- - chunked
27
- Status:
28
- - '200'
29
- X-Powered-By:
30
- - Phusion Passenger (mod_rails/mod_rack) 3.0.14
31
- Etag:
32
- - '"a1996719dbe87ce81ea8d62c3bebc10e"'
33
- X-Runtime:
34
- - '50'
35
- Cache-Control:
36
- - private, max-age=0, must-revalidate
37
- X-Tracker-Project-Version:
38
- - '31'
39
- Server:
40
- - nginx/1.2.2 + Phusion Passenger 3.0.14 (mod_rails/mod_rack)
41
- Access-Control-Allow-Origin:
42
- - '*'
43
- Access-Control-Allow-Credentials:
44
- - 'false'
45
- Access-Control-Allow-Methods:
46
- - GET, POST, PUT, DELETE, OPTIONS
47
- Access-Control-Allow-Headers:
48
- - X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is
49
- body:
50
- encoding: UTF-8
51
- string: |-
52
- {
53
- "kind": "story",
54
- "requested_by_id": 1240260,
55
- "estimate": 4,
56
- "labels": [
57
-
58
- ],
59
- "owner_ids": [
60
-
61
- ],
62
- "id": 65069954,
63
- "created_at": "2014-02-04T01:02:39Z",
64
- "updated_at": "2014-02-04T01:54:20Z",
65
- "url": "http://www.pivotaltracker.com/story/show/65069954",
66
- "story_type": "feature",
67
- "project_id": 1007746,
68
- "name": "TEST: pivotal_tracker_api_story",
69
- "current_state": "unscheduled"
70
- }
71
- http_version:
72
- recorded_at: Fri, 11 Apr 2014 17:17:43 GMT
73
- recorded_with: VCR 2.8.0
@@ -1,217 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://www.pivotaltracker.com/services/v5/stories/65072638
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.9.0
12
- X-Trackertoken:
13
- - <PIVOTAL_API_TOKEN>
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - '*/*'
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Content-Type:
24
- - application/json; charset=utf-8
25
- Transfer-Encoding:
26
- - chunked
27
- Status:
28
- - '200'
29
- X-Powered-By:
30
- - Phusion Passenger (mod_rails/mod_rack) 3.0.14
31
- Etag:
32
- - '"520723207a9ac25967e0eedd67886bce"'
33
- X-Runtime:
34
- - '60'
35
- Cache-Control:
36
- - private, max-age=0, must-revalidate
37
- X-Tracker-Project-Version:
38
- - '30'
39
- Server:
40
- - nginx/1.2.2 + Phusion Passenger 3.0.14 (mod_rails/mod_rack)
41
- Access-Control-Allow-Origin:
42
- - '*'
43
- Access-Control-Allow-Credentials:
44
- - 'false'
45
- Access-Control-Allow-Methods:
46
- - GET, POST, PUT, DELETE, OPTIONS
47
- Access-Control-Allow-Headers:
48
- - X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is
49
- body:
50
- encoding: UTF-8
51
- string: |-
52
- {
53
- "kind": "story",
54
- "requested_by_id": 1240260,
55
- "description": "This story should have no estimate in it to properly test the update.",
56
- "labels": [
57
-
58
- ],
59
- "owner_ids": [
60
-
61
- ],
62
- "id": 65072638,
63
- "created_at": "2014-02-04T01:55:49Z",
64
- "updated_at": "2014-02-04T02:51:52Z",
65
- "url": "http://www.pivotaltracker.com/story/show/65072638",
66
- "story_type": "feature",
67
- "project_id": 1007746,
68
- "name": "TEST: pivotal_tracker_api_update_story *(estimate should not be set)*",
69
- "current_state": "unscheduled"
70
- }
71
- http_version:
72
- recorded_at: Fri, 11 Apr 2014 17:17:41 GMT
73
- - request:
74
- method: put
75
- uri: https://www.pivotaltracker.com/services/v5/stories/65072638
76
- body:
77
- encoding: UTF-8
78
- string: '{"estimate":8}'
79
- headers:
80
- User-Agent:
81
- - Faraday v0.9.0
82
- Content-Type:
83
- - application/json
84
- X-Trackertoken:
85
- - <PIVOTAL_API_TOKEN>
86
- Accept-Encoding:
87
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
88
- Accept:
89
- - '*/*'
90
- response:
91
- status:
92
- code: 200
93
- message: OK
94
- headers:
95
- Content-Type:
96
- - application/json; charset=utf-8
97
- Content-Length:
98
- - '530'
99
- Status:
100
- - '200'
101
- X-Powered-By:
102
- - Phusion Passenger (mod_rails/mod_rack) 3.0.14
103
- Etag:
104
- - '"9e3b83e5b6ec14028bb7c34fb3910cae"'
105
- X-Runtime:
106
- - '208'
107
- Cache-Control:
108
- - private, max-age=0, must-revalidate
109
- X-Tracker-Project-Version:
110
- - '31'
111
- Server:
112
- - nginx/1.2.2 + Phusion Passenger 3.0.14 (mod_rails/mod_rack)
113
- Access-Control-Allow-Origin:
114
- - '*'
115
- Access-Control-Allow-Credentials:
116
- - 'false'
117
- Access-Control-Allow-Methods:
118
- - GET, POST, PUT, DELETE, OPTIONS
119
- Access-Control-Allow-Headers:
120
- - X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is
121
- body:
122
- encoding: UTF-8
123
- string: |-
124
- {
125
- "kind": "story",
126
- "requested_by_id": 1240260,
127
- "description": "This story should have no estimate in it to properly test the update.",
128
- "estimate": 8,
129
- "labels": [
130
-
131
- ],
132
- "owner_ids": [
133
-
134
- ],
135
- "id": 65072638,
136
- "created_at": "2014-02-04T01:55:49Z",
137
- "updated_at": "2014-04-11T17:17:39Z",
138
- "url": "http://www.pivotaltracker.com/story/show/65072638",
139
- "story_type": "feature",
140
- "project_id": 1007746,
141
- "name": "TEST: pivotal_tracker_api_update_story *(estimate should not be set)*",
142
- "current_state": "unscheduled"
143
- }
144
- http_version:
145
- recorded_at: Fri, 11 Apr 2014 17:17:42 GMT
146
- - request:
147
- method: get
148
- uri: https://www.pivotaltracker.com/services/v5/stories/65072638
149
- body:
150
- encoding: US-ASCII
151
- string: ''
152
- headers:
153
- User-Agent:
154
- - Faraday v0.9.0
155
- X-Trackertoken:
156
- - <PIVOTAL_API_TOKEN>
157
- Accept-Encoding:
158
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
159
- Accept:
160
- - '*/*'
161
- response:
162
- status:
163
- code: 200
164
- message: OK
165
- headers:
166
- Content-Type:
167
- - application/json; charset=utf-8
168
- Transfer-Encoding:
169
- - chunked
170
- Status:
171
- - '200'
172
- X-Powered-By:
173
- - Phusion Passenger (mod_rails/mod_rack) 3.0.14
174
- Etag:
175
- - '"9e3b83e5b6ec14028bb7c34fb3910cae"'
176
- X-Runtime:
177
- - '56'
178
- Cache-Control:
179
- - private, max-age=0, must-revalidate
180
- X-Tracker-Project-Version:
181
- - '31'
182
- Server:
183
- - nginx/1.2.2 + Phusion Passenger 3.0.14 (mod_rails/mod_rack)
184
- Access-Control-Allow-Origin:
185
- - '*'
186
- Access-Control-Allow-Credentials:
187
- - 'false'
188
- Access-Control-Allow-Methods:
189
- - GET, POST, PUT, DELETE, OPTIONS
190
- Access-Control-Allow-Headers:
191
- - X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is
192
- body:
193
- encoding: UTF-8
194
- string: |-
195
- {
196
- "kind": "story",
197
- "requested_by_id": 1240260,
198
- "description": "This story should have no estimate in it to properly test the update.",
199
- "estimate": 8,
200
- "labels": [
201
-
202
- ],
203
- "owner_ids": [
204
-
205
- ],
206
- "id": 65072638,
207
- "created_at": "2014-02-04T01:55:49Z",
208
- "updated_at": "2014-04-11T17:17:39Z",
209
- "url": "http://www.pivotaltracker.com/story/show/65072638",
210
- "story_type": "feature",
211
- "project_id": 1007746,
212
- "name": "TEST: pivotal_tracker_api_update_story *(estimate should not be set)*",
213
- "current_state": "unscheduled"
214
- }
215
- http_version:
216
- recorded_at: Fri, 11 Apr 2014 17:17:42 GMT
217
- recorded_with: VCR 2.8.0
@@ -1,79 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://www.pivotaltracker.com/services/v5/me
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Faraday v0.9.0
12
- X-Trackertoken:
13
- - <PIVOTAL_API_TOKEN>
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- Accept:
17
- - '*/*'
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Content-Type:
24
- - application/json; charset=utf-8
25
- Transfer-Encoding:
26
- - chunked
27
- Status:
28
- - '200'
29
- X-Powered-By:
30
- - Phusion Passenger (mod_rails/mod_rack) 3.0.14
31
- Etag:
32
- - '"99739549742ff0cda850a10841def930"'
33
- X-Runtime:
34
- - '26'
35
- Cache-Control:
36
- - private, max-age=0, must-revalidate
37
- Server:
38
- - nginx/1.2.2 + Phusion Passenger 3.0.14 (mod_rails/mod_rack)
39
- Access-Control-Allow-Origin:
40
- - '*'
41
- Access-Control-Allow-Credentials:
42
- - 'false'
43
- Access-Control-Allow-Methods:
44
- - GET, POST, PUT, DELETE, OPTIONS
45
- Access-Control-Allow-Headers:
46
- - X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is
47
- body:
48
- encoding: UTF-8
49
- string: |-
50
- {
51
- "api_token": "<PIVOTAL_API_TOKEN>",
52
- "kind": "me",
53
- "has_google_identity": false,
54
- "email": "aaron+tchtesting@substantial.com",
55
- "username": "tcht",
56
- "receives_in_app_notifications": true,
57
- "initials": "TT",
58
- "time_zone": {
59
- "kind": "time_zone",
60
- "olson_name": "America/Los_Angeles",
61
- "offset": "-07:00"
62
- },
63
- "id": 1240260,
64
- "name": "Tch Testing",
65
- "projects": [
66
- {
67
- "project_name": "Tch Start Testing",
68
- "kind": "membership_summary",
69
- "role": "owner",
70
- "id": 3907566,
71
- "last_viewed_at": "2014-02-04T16:39:33Z",
72
- "project_color": "e46642",
73
- "project_id": 1007746
74
- }
75
- ]
76
- }
77
- http_version:
78
- recorded_at: Fri, 11 Apr 2014 17:17:44 GMT
79
- recorded_with: VCR 2.8.0