much-rails 0.2.3 → 0.2.4
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 +4 -4
- data/lib/much-rails/action/base_router.rb +10 -10
- data/lib/much-rails/action/router.rb +10 -4
- data/lib/much-rails/version.rb +1 -1
- data/test/unit/action/base_router_tests.rb +10 -10
- data/test/unit/action/router_tests.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b0abf64ca287edfd1a6546db5766e878424a9165a661ef991ca7fda1dba6f78
|
4
|
+
data.tar.gz: 3aa006e90bb01924786952077cb5a72c595bb1c0fa28e4f32f3701063fc2ac06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92884c3070b8cbaf78ff384b7ea4bc12476ee175a56e73b4ea58431f84c3539c1d27d97e180b9ddcfbc16ba908127a6783c72f3716890ac5e879773dde7ff4e1
|
7
|
+
data.tar.gz: '0755183185e5f64a4c0e289e31d6bf0545438c96631847f306f83c0aa588308d215583ab2249e856c35592162438dc8cc4315ac959bb478a14baa9aa5c08584f'
|
@@ -70,8 +70,8 @@ class MuchRails::Action::BaseRouter
|
|
70
70
|
# url :users, "/users", "Users::Index"
|
71
71
|
# }
|
72
72
|
# AdminRouter.path_for(:users) # => "/admin/users"
|
73
|
-
def path_for(name,
|
74
|
-
@url_set.path_for(name,
|
73
|
+
def path_for(name, **kargs)
|
74
|
+
@url_set.path_for(name, **kargs)
|
75
75
|
end
|
76
76
|
|
77
77
|
# Example:
|
@@ -87,8 +87,8 @@ class MuchRails::Action::BaseRouter
|
|
87
87
|
# url :users, "/users", "Users::Index"
|
88
88
|
# }
|
89
89
|
# AdminRouter.url_for(:users) # => "http://example.org/admin/users"
|
90
|
-
def url_for(name,
|
91
|
-
@url_set.url_for(name,
|
90
|
+
def url_for(name, **kargs)
|
91
|
+
@url_set.url_for(name, **kargs)
|
92
92
|
end
|
93
93
|
|
94
94
|
# Example:
|
@@ -350,12 +350,12 @@ class MuchRails::Action::BaseRouter
|
|
350
350
|
end
|
351
351
|
end
|
352
352
|
|
353
|
-
def path_for(name,
|
354
|
-
fetch(name).path_for(
|
353
|
+
def path_for(name, **kargs)
|
354
|
+
fetch(name).path_for(**kargs)
|
355
355
|
end
|
356
356
|
|
357
|
-
def url_for(name,
|
358
|
-
fetch(name).url_for(
|
357
|
+
def url_for(name, **kargs)
|
358
|
+
fetch(name).url_for(**kargs)
|
359
359
|
end
|
360
360
|
end
|
361
361
|
|
@@ -396,11 +396,11 @@ class MuchRails::Action::BaseRouter
|
|
396
396
|
self.class.url_path(@router, @url_path)
|
397
397
|
end
|
398
398
|
|
399
|
-
def path_for(
|
399
|
+
def path_for(**kargs)
|
400
400
|
raise NotImplementedError
|
401
401
|
end
|
402
402
|
|
403
|
-
def url_for(
|
403
|
+
def url_for(**kargs)
|
404
404
|
raise NotImplementedError
|
405
405
|
end
|
406
406
|
|
@@ -90,12 +90,18 @@ class MuchRails::Action::Router < MuchRails::Action::BaseRouter
|
|
90
90
|
alias_method :draw, :apply_to
|
91
91
|
|
92
92
|
class URL < MuchRails::Action::BaseRouter::BaseURL
|
93
|
-
def path_for(
|
94
|
-
MuchRails::RailsRoutes.instance.public_send(
|
93
|
+
def path_for(**kargs)
|
94
|
+
MuchRails::RailsRoutes.instance.public_send(
|
95
|
+
"#{name}_path",
|
96
|
+
**kargs.symbolize_keys,
|
97
|
+
)
|
95
98
|
end
|
96
99
|
|
97
|
-
def url_for(
|
98
|
-
MuchRails::RailsRoutes.instance.public_send(
|
100
|
+
def url_for(**kargs)
|
101
|
+
MuchRails::RailsRoutes.instance.public_send(
|
102
|
+
"#{name}_url",
|
103
|
+
**kargs.symbolize_keys,
|
104
|
+
)
|
99
105
|
end
|
100
106
|
end
|
101
107
|
end
|
data/lib/much-rails/version.rb
CHANGED
@@ -80,13 +80,13 @@ class MuchRails::Action::BaseRouter
|
|
80
80
|
end
|
81
81
|
|
82
82
|
should "build path/URL strings for named URLs" do
|
83
|
-
path_string = subject.path_for(:url1,
|
83
|
+
path_string = subject.path_for(:url1, test: "args")
|
84
84
|
assert_that(path_string).equals("TEST PATH STRING")
|
85
|
-
assert_that(@url_set_path_for_call.args).equals([:url1,
|
85
|
+
assert_that(@url_set_path_for_call.args).equals([:url1, { test: "args" }])
|
86
86
|
|
87
|
-
url_string = subject.url_for(:url1,
|
87
|
+
url_string = subject.url_for(:url1, test: "args")
|
88
88
|
assert_that(url_string).equals("TEST URL STRING")
|
89
|
-
assert_that(@url_set_url_for_call.args).equals([:url1,
|
89
|
+
assert_that(@url_set_url_for_call.args).equals([:url1, { test: "args" }])
|
90
90
|
end
|
91
91
|
|
92
92
|
should "define request types" do
|
@@ -380,13 +380,13 @@ class MuchRails::Action::BaseRouter
|
|
380
380
|
|
381
381
|
subject.add(:url1, Factory.url)
|
382
382
|
|
383
|
-
path_string = subject.path_for(:url1,
|
383
|
+
path_string = subject.path_for(:url1, test: "args")
|
384
384
|
assert_that(path_string).equals("TEST PATH STRING")
|
385
|
-
assert_that(@url_path_for_call.args).equals([
|
385
|
+
assert_that(@url_path_for_call.args).equals([{ test: "args" }])
|
386
386
|
|
387
|
-
url_string = subject.url_for(:url1,
|
387
|
+
url_string = subject.url_for(:url1, test: "args")
|
388
388
|
assert_that(url_string).equals("TEST URL STRING")
|
389
|
-
assert_that(@url_url_for_call.args).equals([
|
389
|
+
assert_that(@url_url_for_call.args).equals([{ test: "args" }])
|
390
390
|
end
|
391
391
|
end
|
392
392
|
|
@@ -450,8 +450,8 @@ class MuchRails::Action::BaseRouter
|
|
450
450
|
assert_that(subject.path)
|
451
451
|
.equals(base_url_class.url_path(router1, url_path1))
|
452
452
|
|
453
|
-
assert_that{ subject.path_for(
|
454
|
-
assert_that{ subject.url_for(
|
453
|
+
assert_that{ subject.path_for(test: "args") }.raises(NotImplementedError)
|
454
|
+
assert_that{ subject.url_for(test: "args") }.raises(NotImplementedError)
|
455
455
|
end
|
456
456
|
end
|
457
457
|
|
@@ -206,15 +206,15 @@ class MuchRails::Action::Router
|
|
206
206
|
should have_imeths :path_for, :url_for
|
207
207
|
|
208
208
|
should "know its attributes" do
|
209
|
-
path_string = subject.path_for(
|
209
|
+
path_string = subject.path_for(test: "args")
|
210
210
|
assert_that(path_string).equals("TEST PATH OR URL STRING")
|
211
211
|
assert_that(@rails_routes_method_missing_call.args)
|
212
|
-
.equals(["#{url_name1}_path".to_sym,
|
212
|
+
.equals(["#{url_name1}_path".to_sym, { test: "args" }])
|
213
213
|
|
214
|
-
url_string = subject.url_for(
|
214
|
+
url_string = subject.url_for(test: "args")
|
215
215
|
assert_that(url_string).equals("TEST PATH OR URL STRING")
|
216
216
|
assert_that(@rails_routes_method_missing_call.args)
|
217
|
-
.equals(["#{url_name1}_url".to_sym,
|
217
|
+
.equals(["#{url_name1}_url".to_sym, { test: "args" }])
|
218
218
|
end
|
219
219
|
end
|
220
220
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: much-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kelly Redding
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-02-
|
12
|
+
date: 2021-02-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: much-style-guide
|