gergich 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gergich.rb +7 -0
  3. data/spec/gergich_spec.rb +13 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63c9da0967fcb4d7728a748f1b64011e2fa03d02
4
- data.tar.gz: 45e9c346faca8b021db278e2f6f96f32b9184b20
3
+ metadata.gz: b8af2aab61e1b5c93269e3d9e2e6d4fb5dd01201
4
+ data.tar.gz: 88a33e274c6a36ec65be8e32a05c151ef747f4d1
5
5
  SHA512:
6
- metadata.gz: 170522d85e67ccb5293e3b4a797814abba906dd76eeb2769fa335b1723949bc73e22d922c44f32bb741e6d92f39b69ee90754b52b3dc7a7be7ffcbb049943579
7
- data.tar.gz: ea79a99e4ffe01e6902908ffce696cd37843f67ac7fdf0449d6dc0eeaf91ec91147a1cfb2ab41428db2c450c8b101615c243c42a2114a37c7c3ff01e69e1dd04
6
+ metadata.gz: dc12a8e5761990be3b1de20fa15dfd9392e83dcdb2c6a72553d859b9e88787550129fe48006674e4f4594f3170fd39037dfa8cb17440860d766634556a0a576f
7
+ data.tar.gz: 9da9a59b35a715a688d7e9f3e700a011ccfa4ee027b8454c60fb70ef694faa9a80d5834e83458392947f38b26a322e0e7f99805c93e0ae642cdfcfd8261349a8
@@ -197,6 +197,13 @@ module Gergich
197
197
  ret = HTTParty.send(method, url, options).body
198
198
  if ret.sub!(/\A\)\]\}'\n/, "") && ret =~ /\A("|\[|\{)/
199
199
  JSON.parse("[#{ret}]")[0] # array hack so we can parse a string literal
200
+ elsif ret =~ /Not Found: (?<change_id>.*)/
201
+ raise("Cannot find Change-Id: #{Regexp.last_match[:change_id]}.\n"\
202
+ "This is most likely due to this"\
203
+ " Change-Id already being used"\
204
+ " by an ABANDONED change.\n"\
205
+ "To fix, `git commit --amend`,"\
206
+ " remove the Change-Id line, and push again.")
200
207
  else
201
208
  raise("Non-JSON response: #{ret}")
202
209
  end
@@ -1,5 +1,18 @@
1
1
  require_relative "../lib/gergich"
2
2
 
3
+ RSpec.describe Gergich::API do
4
+ let(:result) { double(:result, { body: "Not Found: 1234" }) }
5
+
6
+ before :each do
7
+ allow(HTTParty).to receive(:send).and_return(result)
8
+ allow(described_class).to receive(:base_options).and_return({})
9
+ end
10
+
11
+ it "provides helpful error when Change-Id not found" do
12
+ expect { described_class.get("/a/changes/1234") }.to raise_error(/Cannot find Change-Id: 1234/)
13
+ end
14
+ end
15
+
3
16
  RSpec.describe Gergich::Draft do
4
17
  let!(:draft) do
5
18
  commit = double(:commit, {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gergich
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-27 00:00:00.000000000 Z
11
+ date: 2016-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3