gris 0.6.0 → 0.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e442419cb2acf2a727b4479cf0dd96abc9b67c11
4
- data.tar.gz: 1cdc3caa247d14bf57458283400ab2ac87a7b7d9
3
+ metadata.gz: 2c3e460b2255bedab70d43a4195880d153eb9a1b
4
+ data.tar.gz: 3300bcd6acfded8f5077b3410164b55fd972926b
5
5
  SHA512:
6
- metadata.gz: 9ac390a50ec60b1370637cbb419fd232beffc316a540e1af715bf824c0a8543609ef822b2e7ee4be035ace1f1e3ce027bc2af823158be546c3d5e6f4ab4d23ce
7
- data.tar.gz: 8dc4b7dede9f6e13508d041ec84bcd2599253880c4fe0cae266729c299e7a966b53985daad5c145a2bd65aacdb197834d349c2369b18832b1b1bc88724414d59
6
+ metadata.gz: b9d8bab341a841ff7aa718b55622c7f7f273ba0292711e2137991bf5df54c50d3b8c7176e613c3f7bc5616e3ade7a3d5d527da87fae1fc3edb4baf8597a0a624
7
+ data.tar.gz: 904ed6613b34f26ce6ad527a903bba7345f7415bdecdda154b90da5ffd5287dfeca5d59f35e1d3250293fd59e015205c24c71e379361eda7d529a2eec5e649aa
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2015-12-28 10:08:44 -0500 using RuboCop version 0.34.2.
3
+ # on 2016-01-23 12:59:28 -0500 using RuboCop version 0.34.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -30,7 +30,7 @@ Metrics/ClassLength:
30
30
  Metrics/CyclomaticComplexity:
31
31
  Max: 11
32
32
 
33
- # Offense count: 80
33
+ # Offense count: 81
34
34
  # Configuration parameters: AllowURI, URISchemes.
35
35
  Metrics/LineLength:
36
36
  Max: 159
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.2.4
1
+ ruby-2.3.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gris (0.6.0)
4
+ gris (0.6.1)
5
5
  activesupport (~> 4.2, >= 4.2.0)
6
6
  chronic (~> 0.10.0)
7
7
  dalli (~> 2.7)
@@ -131,7 +131,7 @@ GEM
131
131
  rack (>= 1.0)
132
132
  rack-test (>= 0.5)
133
133
  rainbow (2.0.0)
134
- rake (10.4.2)
134
+ rake (10.5.0)
135
135
  representable (2.3.0)
136
136
  uber (~> 0.0.7)
137
137
  roar (1.0.4)
@@ -1,6 +1,5 @@
1
1
  .DS_Store
2
2
  .env
3
- .rspec
4
3
  .env.*
5
4
  !log/.keep
6
5
  log/*
@@ -1 +1 @@
1
- 2.2.4
1
+ 2.3.0
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
- ruby '2.2.4'
2
+ ruby '2.3.0'
3
3
 
4
4
  gem 'rack-cors'
5
5
  gem 'pg'
@@ -15,10 +15,13 @@ module Gris
15
15
  end
16
16
  rescue RuntimeError => e
17
17
  error = { status: 500, message: e.message }
18
- error_response(error.to_json, 500)
18
+ error_response error.to_json, 500
19
19
  rescue ::ActiveRecord::RecordNotFound => e
20
20
  error = { status: 404, message: e.message }
21
- error_response(error.to_json, 404)
21
+ error_response error.to_json, 404
22
+ rescue ::ActiveRecord::RecordInvalid => e
23
+ error = { status: 409, message: e.message }
24
+ error_response error.to_json, 409
22
25
  end
23
26
 
24
27
  private
data/lib/gris/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Gris
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
 
4
4
  class Version
5
5
  class << self
@@ -49,9 +49,9 @@ describe Gris::Generators::ScaffoldGenerator do
49
49
  expect(seed_file).to match(/all the record creation needed to seed the database/)
50
50
  end
51
51
 
52
- it 'adds ruby 2.2.4 to Gemfile' do
52
+ it 'adds ruby 2.3.0 to Gemfile' do
53
53
  gemfile = File.read("#{app_path}/Gemfile")
54
- expect(gemfile).to match(/ruby '2.2.4'/)
54
+ expect(gemfile).to match(/ruby '2.3.0'/)
55
55
  end
56
56
 
57
57
  it 'adds the puma gem in the Gemfile' do
@@ -7,13 +7,20 @@ describe Gris::Middleware::ErrorHandlers do
7
7
 
8
8
  let(:app) { subject }
9
9
 
10
- let(:fake_active_record) do
10
+ let(:fake_active_record_record_not_found) do
11
11
  module ActiveRecord
12
12
  class RecordNotFound < StandardError
13
13
  end
14
14
  end
15
15
  end
16
16
 
17
+ let(:fake_active_record_record_invalid) do
18
+ module ActiveRecord
19
+ class RecordInvalid < StandardError
20
+ end
21
+ end
22
+ end
23
+
17
24
  before do
18
25
  subject.format :json
19
26
  subject.use Gris::Middleware::ErrorHandlers
@@ -30,9 +37,13 @@ describe Gris::Middleware::ErrorHandlers do
30
37
  error! 'Forbidden', 401
31
38
  end
32
39
 
33
- subject.get :activerecord_error do
40
+ subject.get :record_not_found do
34
41
  fail ActiveRecord::RecordNotFound
35
42
  end
43
+
44
+ subject.get :record_invalid do
45
+ fail ActiveRecord::RecordInvalid
46
+ end
36
47
  end
37
48
 
38
49
  it 'retuns a Not Found error for missing routes' do
@@ -55,13 +66,21 @@ describe Gris::Middleware::ErrorHandlers do
55
66
  end
56
67
 
57
68
  it 'returns a formatted message for ActiveRecord::RecordNotFound' do
58
- fake_active_record
59
- get '/activerecord_error'
69
+ fake_active_record_record_not_found
70
+ get '/record_not_found'
60
71
  expect(response_code).to eq 404
61
72
  expect(parsed_response_body['status']).to eq 404
62
73
  expect(parsed_response_body['message']).to eq 'ActiveRecord::RecordNotFound'
63
74
  end
64
75
 
76
+ it 'returns a formatted message for ActiveRecord::RecordNotFound' do
77
+ fake_active_record_record_invalid
78
+ get '/record_invalid'
79
+ expect(response_code).to eq 409
80
+ expect(parsed_response_body['status']).to eq 409
81
+ expect(parsed_response_body['message']).to eq 'ActiveRecord::RecordInvalid'
82
+ end
83
+
65
84
  it 'returns a formatted message when an exception is raised' do
66
85
  get '/generic_error'
67
86
  expect(response_code).to eq 500
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Fareed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-28 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -426,7 +426,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
426
426
  version: '0'
427
427
  requirements: []
428
428
  rubyforge_project:
429
- rubygems_version: 2.4.8
429
+ rubygems_version: 2.5.1
430
430
  signing_key:
431
431
  specification_version: 4
432
432
  summary: A simple api microservice generator framework.