rails-rfc6570 2.1.0 → 2.2.0

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.
@@ -1,10 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  ActiveSupport::Inflector.inflections(:en) do |inflect|
4
6
  inflect.acronym 'API'
5
7
  end
6
8
 
7
-
8
9
  Dummy::Application.routes.draw do
9
10
  get '/' => 'api#index', as: :root
10
11
 
@@ -25,7 +26,7 @@ class APIController < ApplicationController
25
26
  render json: rfc6570_routes
26
27
  end
27
28
 
28
- rfc6570_params action: [:param1, :param2]
29
+ rfc6570_params action: %i[param1 param2]
29
30
  def action
30
31
  render json: {
31
32
  ref: action_url,
@@ -33,7 +34,7 @@ class APIController < ApplicationController
33
34
  template_url: action_url_rfc6570,
34
35
  template_path: action_path_rfc6570,
35
36
  partial: test6_rfc6570.partial_expand(title: 'TITLE'),
36
- expand: test6_rfc6570.expand(capture: %w(a b), title: 'TITLE')
37
+ expand: test6_rfc6570.expand(capture: %w[a b], title: 'TITLE')
37
38
  }
38
39
  end
39
40
 
@@ -54,7 +55,7 @@ describe Rails::RFC6570, type: :request do
54
55
  before { get '/' }
55
56
 
56
57
  it 'should return list of all parsed and named routes' do
57
- expect(json.keys).to match_array %w(root action test1 test2 test3 test4 test5 test6)
58
+ expect(json.keys).to match_array %w[root action test1 test2 test3 test4 test5 test6]
58
59
  end
59
60
 
60
61
  it 'should include known parameters' do
@@ -102,7 +103,7 @@ describe Rails::RFC6570, type: :request do
102
103
  end
103
104
 
104
105
  it 'should allow to return and render path templates' do
105
- expect(json['template_path']).to eq "/action{?param1,param2}"
106
+ expect(json['template_path']).to eq '/action{?param1,param2}'
106
107
  end
107
108
 
108
109
  it 'should allow to return and render partial expanded templates' do
@@ -113,18 +114,18 @@ describe Rails::RFC6570, type: :request do
113
114
  expect(json['expand']).to eq "#{host}/path/a/b/TITLE"
114
115
  end
115
116
 
116
- context 'with origin_script_name' do
117
- let(:headers) { {'__OSN' => '/fuubar'} }
117
+ if Rails::VERSION::MAJOR >= 5
118
+ context 'with origin_script_name' do
119
+ let(:headers) { {'__OSN' => '/fuubar'} }
118
120
 
119
- before do
120
- if Rails::VERSION::MAJOR >= 5
121
+ before do
121
122
  # Consistency check with normal URL helper
122
123
  expect(json['ref']).to eq "#{host}/fuubar/action"
123
124
  end
124
- end
125
125
 
126
- it 'prefixes origin script name' do
127
- expect(json['template']).to eq "#{host}/fuubar/action{?param1,param2}"
126
+ it 'prefixes origin script name' do
127
+ expect(json['template']).to eq "#{host}/fuubar/action{?param1,param2}"
128
+ end
128
129
  end
129
130
  end
130
131
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Coverage
2
4
  require 'coveralls'
3
5
  Coveralls.wear! do
@@ -13,11 +15,13 @@ Rails.backtrace_cleaner.remove_silencers!
13
15
 
14
16
  # Requires supporting ruby files with custom matchers and macros, etc,
15
17
  # in spec/support/ and its subdirectories.
16
- Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f }
18
+ Dir[File.expand_path('../support/**/*.rb', __FILE__)].each {|f| require f }
17
19
 
18
20
  # Checks for pending migrations before tests are run.
19
21
  # If you are not using ActiveRecord, you can remove this line.
20
- ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration) && Rails::VERSION::MAJOR >= 4
22
+ if defined?(ActiveRecord::Migration) && Rails::VERSION::MAJOR >= 4
23
+ ActiveRecord::Migration.check_pending!
24
+ end
21
25
 
22
26
  RSpec.configure do |config|
23
27
  config.order = 'random'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-rfc6570
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-06 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.2'
22
+ version: '6'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.2'
32
+ version: '6'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: addressable
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '1.5'
61
- description: Pragmatical access to your Rails routes as RFC6570 URI templates.
61
+ description:
62
62
  email:
63
63
  - jg@altimos.de
64
64
  executables: []
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.6.13
126
+ rubygems_version: 2.7.3
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Pragmatical access to your Rails routes as RFC6570 URI templates.