gris 0.2.1 → 0.2.2

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: 9ff6ba8261f1cca3c6a660af036c196c47ae34ad
4
- data.tar.gz: 8fda53f634f7e03cd90a87b495ffba548e2ad7ee
3
+ metadata.gz: 8d20ee54cd68f8114a89f4c0a3395393961f9699
4
+ data.tar.gz: 74dcbe89b0563d637c5f6866148536aa8f6bb750
5
5
  SHA512:
6
- metadata.gz: 803be7f9239a72edc4227e2c0b5019d9dac2325359a1924610016c158b37357f40db6aa53aed4e6b05fdfeb641a328c4488c3ebf20e1e169e27bc80eb2da932a
7
- data.tar.gz: 0e9b303cce658e25f64709449412bae655c15b0e0a672f7256d908b67d446fb74fef4617fdd1421bb2f257677fc1d7b00a1f8e91f553278695312cb42b50b29a
6
+ metadata.gz: d779fbbfb89c625123cf69f19a9faa7bf8f239954a96addb5d8385ebc18da4902157e6b06a60daee850c46c3c299ed667506b2fafaea68c0d7979294aabf7a13
7
+ data.tar.gz: 1973b2ba6aa51da0ae991f35bf26eb4adbe4e82b8f042f34b5d42377847ac98f90832ad09684a9fb6df4d4dc5d27f19f31d21c8ae385d2252a66ffffa7549d90
@@ -1,5 +1,5 @@
1
1
  # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2015-05-19 11:04:31 -0400 using RuboCop version 0.31.0.
2
+ # on 2015-05-20 22:54:33 -0400 using RuboCop version 0.31.0.
3
3
  # The point is for the user to remove these configuration records
4
4
  # one by one as the offenses are removed from the code base.
5
5
  # Note that changes in the inspected code, or installation of new
@@ -29,7 +29,7 @@ Metrics/CyclomaticComplexity:
29
29
  Metrics/LineLength:
30
30
  Max: 159
31
31
 
32
- # Offense count: 8
32
+ # Offense count: 9
33
33
  # Configuration parameters: CountComments.
34
34
  Metrics/MethodLength:
35
35
  Max: 27
@@ -57,12 +57,6 @@ Style/DoubleNegation:
57
57
  Style/PredicateName:
58
58
  Enabled: false
59
59
 
60
- # Offense count: 1
61
- # Cop supports --auto-correct.
62
- # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
63
- Style/RegexpLiteral:
64
- Enabled: false
65
-
66
60
  # Offense count: 1
67
61
  # Cop supports --auto-correct.
68
62
  # Configuration parameters: MultiSpaceAllowedForOperators.
data/Gemfile CHANGED
@@ -2,12 +2,16 @@ source 'https://rubygems.org/'
2
2
 
3
3
  gemspec
4
4
 
5
- group :development do
5
+ group :development, :test do
6
6
  gem 'byebug'
7
+ end
8
+
9
+ group :development do
7
10
  gem 'rubocop'
8
- gem 'guard-rspec', require: false
9
- gem 'guard-rubocop'
10
- gem 'rake', '~> 10.0'
11
- gem 'fakefs', '~> 0.4'
12
- gem 'fasterer', '~> 0.1'
11
+ gem 'fasterer'
12
+ end
13
+
14
+ group :test do
15
+ gem 'childprocess'
16
+ gem 'hyperclient'
13
17
  end
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gris (0.2.1)
4
+ gris (0.2.2)
5
5
  activesupport (~> 4.2, >= 4.2.0)
6
6
  chronic (~> 0.10.0)
7
+ dalli (~> 2.7)
7
8
  dotenv (~> 2.0, >= 2.0)
8
9
  git (~> 1.2, >= 1.2.8)
9
10
  grape (~> 0.11.0, >= 0.11.0)
@@ -46,25 +47,33 @@ GEM
46
47
  builder (3.2.2)
47
48
  byebug (5.0.0)
48
49
  columnize (= 0.9.0)
49
- celluloid (0.16.0)
50
- timers (~> 4.0.0)
50
+ childprocess (0.5.6)
51
+ ffi (~> 1.0, >= 1.0.11)
51
52
  chronic (0.10.2)
52
- coderay (1.1.0)
53
53
  coercible (1.0.0)
54
54
  descendants_tracker (~> 0.0.1)
55
55
  colorize (0.7.7)
56
56
  columnize (0.9.0)
57
+ dalli (2.7.4)
57
58
  descendants_tracker (0.0.4)
58
59
  thread_safe (~> 0.3, >= 0.3.1)
59
60
  diff-lcs (1.2.5)
60
61
  dotenv (2.0.1)
61
62
  equalizer (0.0.11)
62
- fakefs (0.6.7)
63
+ faraday (0.9.1)
64
+ multipart-post (>= 1.2, < 3)
65
+ faraday-digestauth (0.2.1)
66
+ faraday (~> 0.7)
67
+ net-http-digest_auth (~> 1.4)
68
+ faraday_hal_middleware (0.0.1)
69
+ faraday_middleware (>= 0.9, < 0.10)
70
+ faraday_middleware (0.9.1)
71
+ faraday (>= 0.7.4, < 0.10)
63
72
  fasterer (0.1.9)
64
73
  colorize (~> 0.7)
65
74
  ruby_parser (~> 3.6)
66
75
  ffi (1.9.8)
67
- formatador (0.2.5)
76
+ futuroscope (0.1.11)
68
77
  git (1.2.9.1)
69
78
  grape (0.11.0)
70
79
  activesupport
@@ -85,57 +94,35 @@ GEM
85
94
  grape-swagger (0.10.1)
86
95
  grape (>= 0.8.0)
87
96
  grape-entity
88
- guard (2.12.5)
89
- formatador (>= 0.2.4)
90
- listen (~> 2.7)
91
- lumberjack (~> 1.0)
92
- nenv (~> 0.1)
93
- notiffany (~> 0.0)
94
- pry (>= 0.9.12)
95
- shellany (~> 0.0)
96
- thor (>= 0.18.1)
97
- guard-compat (1.2.1)
98
- guard-rspec (4.5.0)
99
- guard (~> 2.1)
100
- guard-compat (~> 1.1)
101
- rspec (>= 2.99.0, < 4.0)
102
- guard-rubocop (1.2.0)
103
- guard (~> 2.0)
104
- rubocop (~> 0.20)
105
97
  hashie (3.4.1)
106
98
  hashie-forbidden_attributes (0.1.1)
107
99
  hashie (>= 3.0)
108
- hitimes (1.2.2)
100
+ hyperclient (0.7.0)
101
+ faraday (~> 0.8)
102
+ faraday-digestauth (~> 0.2)
103
+ faraday_hal_middleware (~> 0.0.1)
104
+ faraday_middleware (~> 0.9)
105
+ futuroscope (>= 0.0.10)
106
+ net-http-digest_auth (~> 1.2)
107
+ uri_template (~> 0.5)
109
108
  i18n (0.7.0)
110
109
  ice_nine (0.11.1)
111
110
  json (1.8.2)
112
- listen (2.10.0)
113
- celluloid (~> 0.16.0)
114
- rb-fsevent (>= 0.9.3)
115
- rb-inotify (>= 0.9)
116
111
  little-plugger (1.1.3)
117
112
  logging (2.0.0)
118
113
  little-plugger (~> 1.1)
119
114
  multi_json (~> 1.10)
120
- lumberjack (1.0.9)
121
- method_source (0.8.2)
122
115
  mini_portile (0.6.2)
123
116
  minitest (5.6.1)
124
117
  multi_json (1.11.0)
125
118
  multi_xml (0.5.5)
126
- nenv (0.2.0)
119
+ multipart-post (2.0.0)
120
+ net-http-digest_auth (1.4)
127
121
  nokogiri (1.6.6.2)
128
122
  mini_portile (~> 0.6.0)
129
- notiffany (0.0.6)
130
- nenv (~> 0.1)
131
- shellany (~> 0.0)
132
123
  parser (2.2.2.3)
133
124
  ast (>= 1.1, < 3.0)
134
125
  powerpack (0.1.1)
135
- pry (0.10.1)
136
- coderay (~> 1.1.0)
137
- method_source (~> 0.8.1)
138
- slop (~> 3.4)
139
126
  rack (1.6.1)
140
127
  rack-accept (0.4.5)
141
128
  rack (>= 0.4)
@@ -148,9 +135,6 @@ GEM
148
135
  rack-test (>= 0.5)
149
136
  rainbow (2.0.0)
150
137
  rake (10.4.2)
151
- rb-fsevent (0.9.4)
152
- rb-inotify (0.9.5)
153
- ffi (>= 0.5.0)
154
138
  representable (2.2.0)
155
139
  multi_json
156
140
  nokogiri
@@ -180,16 +164,13 @@ GEM
180
164
  ruby_parser (3.6.6)
181
165
  sexp_processor (~> 4.1)
182
166
  sexp_processor (4.5.1)
183
- shellany (0.0.1)
184
- slop (3.6.0)
185
167
  sqlite3 (1.3.10)
186
168
  thor (0.19.1)
187
169
  thread_safe (0.3.5)
188
- timers (4.0.1)
189
- hitimes
190
170
  tzinfo (1.2.2)
191
171
  thread_safe (~> 0.1)
192
172
  uber (0.0.13)
173
+ uri_template (0.7.0)
193
174
  virtus (1.0.5)
194
175
  axiom-types (~> 0.1)
195
176
  coercible (~> 1.0)
@@ -204,11 +185,9 @@ DEPENDENCIES
204
185
  acts_as_fu (~> 0)
205
186
  bundler
206
187
  byebug
207
- fakefs (~> 0.4)
208
- fasterer (~> 0.1)
188
+ childprocess
189
+ fasterer
209
190
  gris!
210
- guard-rspec
211
- guard-rubocop
212
- rake (~> 10.0)
191
+ hyperclient
213
192
  rspec (~> 3.2)
214
193
  rubocop
data/README.md CHANGED
@@ -51,6 +51,18 @@ Commands:
51
51
 
52
52
  ---
53
53
 
54
+ ### Caching
55
+
56
+ You can use caching by including this module in your ActiveRecord models,
57
+
58
+ class OfferEvent < ActiveRecord::Base
59
+ include Gris::CacheKey
60
+ end
61
+
62
+ and then cache inside GET requests like this
63
+
64
+ offer_event = OfferEvent.cached_find(id)
65
+
54
66
  ### The name
55
67
 
56
68
  Gris is named for [Juan Gris](https://www.artsy.net/artist/juan-gris) (but also works in the wine-based word context of Grape and Napa). Cleverness!
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.add_runtime_dependency 'racksh', '~> 1.0'
32
32
  s.add_runtime_dependency 'hashie-forbidden_attributes', '~> 0.1.0'
33
33
  s.add_runtime_dependency 'chronic', '~> 0.10.0'
34
+ s.add_runtime_dependency 'dalli', '~> 2.7'
34
35
 
35
36
  s.add_development_dependency 'bundler'
36
37
  s.add_development_dependency 'rspec', '~> 3.2'
@@ -13,6 +13,7 @@ require 'hashie-forbidden_attributes'
13
13
 
14
14
  # require internal files
15
15
  require 'gris/application'
16
+ require 'gris/cache_key'
16
17
  require 'gris/deprecations'
17
18
  require 'gris/grape_extensions/crud_helpers'
18
19
  require 'gris/grape_extensions/error_helpers'
@@ -0,0 +1,31 @@
1
+ module Gris
2
+ module CacheKey
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ def cache_key
7
+ case
8
+ when new_record?
9
+ fail NotImplementedError
10
+ when timestamp = try(:updated_at)
11
+ timestamp = timestamp.utc.to_s(:number)
12
+ "#{self.class.model_name.cache_key}/#{id}-#{timestamp}"
13
+ else
14
+ "#{self.class.model_name.cache_key}/#{id}"
15
+ end
16
+ end
17
+ end
18
+
19
+ class_methods do
20
+ def cache_key_for(id)
21
+ "#{model_name.cache_key}/#{id}"
22
+ end
23
+
24
+ def cached_find(id)
25
+ Gris.cache.fetch(cache_key_for(id)) do
26
+ find(id)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
- ruby '2.1.5'
2
+ ruby '2.2.2'
3
3
 
4
4
  gem 'rack-cors'
5
5
  gem 'pg'
@@ -16,7 +16,7 @@ module Gris
16
16
 
17
17
  def process_datetime_params(params)
18
18
  return unless keys_to_convert
19
- params.keys.each do |key|
19
+ params.each_key do |key|
20
20
  if keys_to_convert.include?(key)
21
21
  params[key] = string_to_datetime(params[key])
22
22
  end
@@ -19,5 +19,28 @@ module Gris
19
19
  def db_connection_details
20
20
  YAML.load(ERB.new(File.read('./config/database.yml')).result)[Gris.env]
21
21
  end
22
+
23
+ def cache
24
+ @_cache ||= ActiveSupport::Cache.lookup_store(:memory_store)
25
+ end
26
+
27
+ def cache=(store_option)
28
+ @_cache = ActiveSupport::Cache.lookup_store(store_option)
29
+ end
30
+ end
31
+ end
32
+
33
+ # prevent DalliError: Unable to unmarshal value: undefined class/module
34
+ Gris.cache.instance_eval do
35
+ def fetch(key, options = {}, rescue_and_require = true)
36
+ super(key, options)
37
+
38
+ rescue ArgumentError => ex
39
+ if rescue_and_require && %r{^undefined class\/module (.+?)$} =~ ex.message
40
+ self.class.const_missing(Regexp.last_match(1))
41
+ fetch(key, options, false)
42
+ else
43
+ raise ex
44
+ end
22
45
  end
23
46
  end
@@ -1,5 +1,5 @@
1
1
  module Gris
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
 
4
4
  class Version
5
5
  class << self
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Gris::CacheKey' do
4
+ it 'raises an error when cache_key is called on a blank object' do
5
+ @foo = CacheKeyHelper.new
6
+ expect { @foo.cache_key }.to raise_error(NotImplementedError)
7
+ end
8
+
9
+ it 'returns a value for cache_key' do
10
+ @foo = CacheKeyHelper.new(id: SecureRandom.random_number(500))
11
+ expect(@foo.cache_key).to eq("cache_key_helper/#{@foo.id}")
12
+ end
13
+
14
+ it 'returns a value for cache_key_for' do
15
+ id = SecureRandom.random_number(500)
16
+ expect(CacheKeyHelper.cache_key_for(id)).to eq("cache_key_helper/#{id}")
17
+ end
18
+
19
+ it 'uses the cache for cached_find' do
20
+ id = SecureRandom.random_number(500)
21
+ foo = CacheKeyHelper.cached_find(id)
22
+ expect(foo.id).to eq(id)
23
+ allow(Gris.cache).to receive(:fetch).and_return('cached-result')
24
+ expect(CacheKeyHelper.cached_find(id)).to eq('cached-result')
25
+ end
26
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+ require 'gris/identity'
3
+
4
+ describe 'Gris.cache' do
5
+ before(:each) do
6
+ @cache = Gris.cache
7
+ end
8
+
9
+ it 'caches things' do
10
+ expect(@cache.read('x')).to be_nil
11
+ @cache.write('x', 'abc')
12
+ expect(@cache.read('x')).to eq('abc')
13
+ end
14
+ end
@@ -1,6 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'gris/generators/api_generator'
3
- require 'gris/cli'
4
2
 
5
3
  describe Gris::Generators::ApiGenerator do
6
4
  include_context 'with generator'
@@ -1,6 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'gris/generators/migration_generator'
3
- require 'gris/cli'
4
2
 
5
3
  describe Gris::Generators::MigrationGenerator do
6
4
  include_context 'with generator'
@@ -1,6 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'gris/generators/scaffold_generator'
3
- require 'gris/cli'
4
2
 
5
3
  describe Gris::Generators::ScaffoldGenerator do
6
4
  let(:app_name) { 'my_test_app' }
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+ require 'hyperclient'
3
+
4
+ describe 'token authentication' do
5
+ include_context 'with a generated app'
6
+
7
+ let(:client_url) { "http://localhost:#{app_port}" }
8
+ let(:client) { Hyperclient.new(client_url) }
9
+
10
+ it 'returns a forbidden error' do
11
+ request = Faraday.get client_url
12
+ response = JSON.parse request.body
13
+ expect(response['error']).to include 'Forbidden'
14
+ end
15
+
16
+ context 'with correct token query params' do
17
+ it 'returns the root presenter' do
18
+ client.params['token'] = 'replace-me'
19
+ expect(client._links.self._url).to eq client_url
20
+ end
21
+ end
22
+
23
+ context 'with correct Http-Authorization headers' do
24
+ it 'returns the root presenter' do
25
+ client.headers['Http-Authorization'] = 'replace-me'
26
+ expect(client._links.self._url).to eq client_url
27
+ end
28
+ end
29
+ end
@@ -1,9 +1,10 @@
1
1
  ENV['RACK_ENV'] = 'test'
2
2
 
3
- require 'gris/setup'
4
- require 'gris'
5
-
6
3
  require 'byebug'
4
+ require 'childprocess'
5
+ require 'gris'
6
+ require 'gris/cli'
7
+ require 'rack/test'
7
8
 
8
9
  # Requires supporting ruby files with custom matchers and macros, etc,
9
10
  # in spec/support/ and its subdirectories.
@@ -0,0 +1,26 @@
1
+ require 'active_model'
2
+
3
+ class CacheKeyHelper
4
+ include ActiveModel::Model
5
+ include Gris::CacheKey
6
+
7
+ attr_accessor :id
8
+
9
+ def new_record?
10
+ id.nil?
11
+ end
12
+
13
+ class << self
14
+ def find(id)
15
+ CacheKeyHelper.new(id: id)
16
+ end
17
+
18
+ def model_name
19
+ CacheKeyHelper
20
+ end
21
+
22
+ def cache_key
23
+ 'cache_key_helper'
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,50 @@
1
+ shared_context 'with a generated app' do
2
+ let(:app_name) { 'my_test_app' }
3
+ let(:options) { {} }
4
+ let(:app_port) { 9292 }
5
+ let(:args) { [app_name] }
6
+
7
+ before(:each) do
8
+ scaffold = Gris::CLI::Base.new(args, options)
9
+ scaffold.invoke(:new)
10
+ prepare_app
11
+ end
12
+
13
+ after(:each) do
14
+ @app.stop
15
+ cleanup_generated_app
16
+ end
17
+
18
+ def prepare_app
19
+ Bundler.with_clean_env do
20
+ project = ChildProcess.build('bundle', 'install')
21
+ project.io.inherit!
22
+ project.cwd = app_name
23
+ project.start
24
+ project.wait
25
+ begin
26
+ project.poll_for_exit(10)
27
+ start_app
28
+ rescue ChildProcess::TimeoutError
29
+ project.stop
30
+ end
31
+ end
32
+ end
33
+
34
+ def start_app
35
+ @app = ChildProcess.build('bundle', 'exec', 'rackup')
36
+ @app.environment['PERMITTED_TOKENS'] = 'replace-me'
37
+ @app.io.inherit!
38
+ @app.cwd = app_name
39
+ @app.start
40
+ sleep(1) while !listening_on?(app_port) && @app.alive?
41
+ end
42
+
43
+ def listening_on?(port)
44
+ system("netstat -an | grep #{port} | grep LISTEN")
45
+ end
46
+
47
+ def cleanup_generated_app
48
+ FileUtils.rm_rf(args[0])
49
+ end
50
+ end
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.2.1
4
+ version: 0.2.2
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-05-19 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -234,6 +234,20 @@ dependencies:
234
234
  - - "~>"
235
235
  - !ruby/object:Gem::Version
236
236
  version: 0.10.0
237
+ - !ruby/object:Gem::Dependency
238
+ name: dalli
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - "~>"
242
+ - !ruby/object:Gem::Version
243
+ version: '2.7'
244
+ type: :runtime
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - "~>"
249
+ - !ruby/object:Gem::Version
250
+ version: '2.7'
237
251
  - !ruby/object:Gem::Dependency
238
252
  name: bundler
239
253
  requirement: !ruby/object:Gem::Requirement
@@ -319,7 +333,6 @@ files:
319
333
  - ".ruby-version"
320
334
  - Gemfile
321
335
  - Gemfile.lock
322
- - Guardfile
323
336
  - MIT-LICENSE
324
337
  - README.md
325
338
  - Rakefile
@@ -328,6 +341,7 @@ files:
328
341
  - lib/gris.rb
329
342
  - lib/gris/application.rb
330
343
  - lib/gris/application/configuration.rb
344
+ - lib/gris/cache_key.rb
331
345
  - lib/gris/cli.rb
332
346
  - lib/gris/deprecations.rb
333
347
  - lib/gris/deprecations/gris_setup.rb
@@ -380,6 +394,8 @@ files:
380
394
  - lib/gris/version.rb
381
395
  - lib/tasks/db.rake
382
396
  - lib/tasks/routes.rake
397
+ - spec/cache_key_spec.rb
398
+ - spec/cache_spec.rb
383
399
  - spec/generators/api_generator_spec.rb
384
400
  - spec/generators/migration_generator_spec.rb
385
401
  - spec/generators/scaffold_generator_spec.rb
@@ -388,7 +404,10 @@ files:
388
404
  - spec/grape_extensions/date_time_helpers_spec.rb
389
405
  - spec/grape_extensions/error_helpers_spec.rb
390
406
  - spec/identity_spec.rb
407
+ - spec/integration/token_authentication_spec.rb
391
408
  - spec/spec_helper.rb
409
+ - spec/support/cache_key_helper.rb
410
+ - spec/support/integration_setup.rb
392
411
  - spec/support/spec_api_auth_helper.rb
393
412
  - spec/support/spec_api_error_helper.rb
394
413
  - spec/support/spec_crud_helper.rb
@@ -419,6 +438,8 @@ signing_key:
419
438
  specification_version: 4
420
439
  summary: A simple api microservice generator framework.
421
440
  test_files:
441
+ - spec/cache_key_spec.rb
442
+ - spec/cache_spec.rb
422
443
  - spec/generators/api_generator_spec.rb
423
444
  - spec/generators/migration_generator_spec.rb
424
445
  - spec/generators/scaffold_generator_spec.rb
@@ -427,7 +448,10 @@ test_files:
427
448
  - spec/grape_extensions/date_time_helpers_spec.rb
428
449
  - spec/grape_extensions/error_helpers_spec.rb
429
450
  - spec/identity_spec.rb
451
+ - spec/integration/token_authentication_spec.rb
430
452
  - spec/spec_helper.rb
453
+ - spec/support/cache_key_helper.rb
454
+ - spec/support/integration_setup.rb
431
455
  - spec/support/spec_api_auth_helper.rb
432
456
  - spec/support/spec_api_error_helper.rb
433
457
  - spec/support/spec_crud_helper.rb
data/Guardfile DELETED
@@ -1,82 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- ## Uncomment and set this to only include directories you want to watch
5
- # directories %w(app lib config test spec feature)
6
-
7
- ## Uncomment to clear the screen before every task
8
- # clearing :on
9
-
10
- ## Guard internally checks for changes in the Guardfile and exits.
11
- ## If you want Guard to automatically start up again, run guard in a
12
- ## shell loop, e.g.:
13
- ##
14
- ## $ while bundle exec guard; do echo "Restarting Guard..."; done
15
- ##
16
- ## Note: if you are using the `directories` clause above and you are not
17
- ## watching the project directory ('.'), the you will want to move the Guardfile
18
- ## to a watched dir and symlink it back, e.g.
19
- #
20
- # $ mkdir config
21
- # $ mv Guardfile config/
22
- # $ ln -s config/Guardfile .
23
- #
24
- # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
25
-
26
- # Note: The cmd option is now required due to the increasing number of ways
27
- # rspec may be run, below are examples of the most common uses.
28
- # * bundler: 'bundle exec rspec'
29
- # * bundler binstubs: 'bin/rspec'
30
- # * spring: 'bin/rspec' (This will use spring if running and you have
31
- # installed the spring binstubs per the docs)
32
- # * zeus: 'zeus rspec' (requires the server to be started separately)
33
- # * 'just' rspec: 'rspec'
34
-
35
- guard :rspec, cmd: 'bundle exec rspec' do
36
- require 'guard/rspec/dsl'
37
- dsl = Guard::RSpec::Dsl.new(self)
38
-
39
- # Feel free to open issues for suggestions and improvements
40
-
41
- # RSpec files
42
- rspec = dsl.rspec
43
- watch(rspec.spec_helper) { rspec.spec_dir }
44
- watch(rspec.spec_support) { rspec.spec_dir }
45
- watch(rspec.spec_files)
46
-
47
- # Ruby files
48
- ruby = dsl.ruby
49
- dsl.watch_spec_files_for(ruby.lib_files)
50
-
51
- # Rails files
52
- rails = dsl.rails(view_extensions: %w(erb haml slim))
53
- dsl.watch_spec_files_for(rails.app_files)
54
- dsl.watch_spec_files_for(rails.views)
55
-
56
- watch(rails.controllers) do |m|
57
- [
58
- rspec.spec.call("routing/#{m[1]}_routing"),
59
- rspec.spec.call("controllers/#{m[1]}_controller"),
60
- rspec.spec.call("acceptance/#{m[1]}")
61
- ]
62
- end
63
-
64
- # Rails config changes
65
- watch(rails.spec_helper) { rspec.spec_dir }
66
- watch(rails.routes) { "#{rspec.spec_dir}/routing" }
67
- watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
68
-
69
- # Capybara features specs
70
- watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
71
-
72
- # Turnip features and steps
73
- watch(%r{^spec/acceptance/(.+)\.feature$})
74
- watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
75
- Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
76
- end
77
- end
78
-
79
- guard :rubocop do
80
- watch(%r{.+\.rb$})
81
- watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
82
- end