route_mechanic 0.1.4 → 0.1.5

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
  SHA256:
3
- metadata.gz: dcf55f8d2a48c7a0ff01db79aef7007f04debdf0041446ad54dbee8ef96ef1c9
4
- data.tar.gz: ec43017513f3cb41e85463eb87c0ba6717395fce97cad5cff706a404ddf60bdc
3
+ metadata.gz: 880e2dd0341ed11d953e4a4d27e71431ef393049153224f62231ba3c527252c8
4
+ data.tar.gz: '0592972c3d62edf50cbeb1f4bcfee4473921e789c31eff61cd2673927c22013b'
5
5
  SHA512:
6
- metadata.gz: e2c1f56abcb02e80ea81ccc44cb39fff35166fbc94d413ff8ae838ec98d7c867ddad8a089ce3ad30416c15f331268438e3f06880eabac2c41ba750d062387101
7
- data.tar.gz: 11719f321b17f608408c2d5f195fa332a1a95ef1f491ce23fd3e7a9af2e82e3b940a934bdc5dd96f5d3c6a11bd6b51da895eb8a013b20d5ee42a30d6d6c87354
6
+ metadata.gz: 1a75f67529149119f59e7e78082a4364ea98b15c4906959a75d4970420a877444d36c37e150f21ab4a2a7e347daf80afe2645072f40d93cff18d57a6427fa5e1
7
+ data.tar.gz: 71dd0672e63045a5c386ce4510712f75472a07abc236a8d73b696a361ef4fd65a394afb2578ac8f8b3c216d9d4f5e7142cc823fbef67e52c99b65a28f129fd8d
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  /fixtures/fake_app/log/
11
11
  /fixtures/fake_app/tmp/
12
12
  /.rspec_status
13
+ /.byebug_history
data/Gemfile CHANGED
@@ -7,3 +7,4 @@ gem "rake", "~> 12.0"
7
7
  gem "minitest", "~> 5.0"
8
8
  gem "rspec", "~> 3.0"
9
9
  gem "rails"
10
+ gem "byebug"
@@ -14,6 +14,13 @@ FakeApp.routes.draw do
14
14
  get '/constraints_test' => 'users#index'
15
15
  end
16
16
 
17
+ scope ':locale', locale: /en|ja/ do
18
+ get '/locale_test', to: 'photos#index'
19
+ get '/photos/:id', to: 'photos#show', constraints: { id: /[A-Z]\d{5}/ }
20
+ end
21
+
22
+ get 'organizations/:id', to: 'organizations#show', id: /[A-Z]\d{5}/
23
+
17
24
  resources :users do
18
25
  get 'friends', to: :friends
19
26
  mount FakeEngine::Engine, at: "/fake_engine", fake_default_param: 'FAKE'
@@ -3,6 +3,7 @@ require "route_mechanic/testing/error_aggregator"
3
3
  require "route_mechanic/testing/minitest_assertion_adopter"
4
4
  require "action_controller"
5
5
  require "action_controller/test_case"
6
+ require "regexp-examples"
6
7
 
7
8
  module RouteMechanic
8
9
  module Testing
@@ -45,7 +46,12 @@ module RouteMechanic
45
46
  # @raise [Minitest::Assertion]
46
47
  def assert_routes(wrapper)
47
48
  required_parts = wrapper.required_parts.reduce({}) do |memo, required_part|
48
- memo.merge({ required_part => '1' }) # '1' is pseudo id
49
+ dummy = if wrapper.requirements[required_part].is_a?(Regexp)
50
+ wrapper.requirements[required_part].examples.last
51
+ else
52
+ '1'
53
+ end
54
+ memo.merge({ required_part => dummy }) # Set pseudo params to meets requirements
49
55
  end
50
56
 
51
57
  base_option = { controller: wrapper.controller, action: wrapper.action }
@@ -1,3 +1,3 @@
1
1
  module RouteMechanic
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ["lib"]
26
26
 
27
27
  spec.add_runtime_dependency "actionpack", ">= 4.2", "< 6.1"
28
+ spec.add_runtime_dependency "regexp-examples", ">= 1.5", "< 2"
28
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: route_mechanic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ohbarye
@@ -30,6 +30,26 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '6.1'
33
+ - !ruby/object:Gem::Dependency
34
+ name: regexp-examples
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '1.5'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '2'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '1.5'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '2'
33
53
  description: No need to maintain Rails' routing tests manually. RouteMechanic automatically
34
54
  detects broken routes and missing action methods in controller once you've finished
35
55
  installation.