active_link_to 1.1.0 → 1.1.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 +4 -4
- data/README.md +1 -0
- data/lib/active_link_to/active_link_to.rb +2 -1
- data/lib/active_link_to/version.rb +1 -1
- data/spec/active_link_to_spec.rb +20 -0
- 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: 2e47fd89e74a82acaa58cec5acad77d15f1032cb9fb864fd69f2309d035190c5
|
|
4
|
+
data.tar.gz: 84de88127ce490bb53e0ad7a24d789d74bdc7eb3af7d1685cb0fb3ff1c191e19
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 369a955ee89c2b5df84c57bde6d43f76fe99ef62ab22544b4aa9e09355c0f90afc4461a00aa89d0f3ad45b7aec2020a3833976144dd40ad23cad04b95570a91f
|
|
7
|
+
data.tar.gz: 56a6ed560b77abd73140262c8818051264dd84ab6fe47d9da2d2ae7ed3392d4ef2383e8ad307c93b52aaf4d68b93322e85405941e040ef53a9c05dceec533090
|
data/README.md
CHANGED
|
@@ -4,6 +4,7 @@ Creates a link tag of the given name using a URL created by the set of options.
|
|
|
4
4
|
|
|
5
5
|
[](http://rubygems.org/gems/active_link_to)
|
|
6
6
|
[](http://rubygems.org/gems/active_link_to)
|
|
7
|
+

|
|
7
8
|
|
|
8
9
|
## Install
|
|
9
10
|
|
|
@@ -132,7 +132,8 @@ module ActiveLinkTo
|
|
|
132
132
|
end
|
|
133
133
|
|
|
134
134
|
pairs.any? do |controllers, actions|
|
|
135
|
-
|
|
135
|
+
(controllers.blank? || [*controllers].map(&:to_s).include?(params[:controller])) &&
|
|
136
|
+
(actions.blank? || [*actions].map(&:to_s).include?(params[:action]))
|
|
136
137
|
end
|
|
137
138
|
|
|
138
139
|
when TrueClass
|
data/spec/active_link_to_spec.rb
CHANGED
|
@@ -106,6 +106,26 @@ RSpec.describe ActiveLinkTo do
|
|
|
106
106
|
expect(is_active_link?("/", %w[foos other])).to be(false)
|
|
107
107
|
end
|
|
108
108
|
|
|
109
|
+
it "matches on any action for a given controller" do
|
|
110
|
+
# currently active controller/action pair
|
|
111
|
+
params[:controller] = "foos"
|
|
112
|
+
params[:action] = "bar"
|
|
113
|
+
|
|
114
|
+
expect(is_active_link?("/", [%w[foos bars], []])).to be(true)
|
|
115
|
+
expect(is_active_link?("/", ["foos", []])).to be(true)
|
|
116
|
+
expect(is_active_link?("/", ["bars", []])).to be(false)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
it "matches on any controller for a given action" do
|
|
120
|
+
# currently active controller/action pair
|
|
121
|
+
params[:controller] = "foos"
|
|
122
|
+
params[:action] = "bar"
|
|
123
|
+
|
|
124
|
+
expect(is_active_link?("/", [[], %w[foo bar]])).to be(true)
|
|
125
|
+
expect(is_active_link?("/", [[], "bar"])).to be(true)
|
|
126
|
+
expect(is_active_link?("/", [[], "foo"])).to be(false)
|
|
127
|
+
end
|
|
128
|
+
|
|
109
129
|
it "works when flag is defined as a hash" do
|
|
110
130
|
# currently active controller/action pair
|
|
111
131
|
params[:controller] = "foos"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_link_to
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oleg Khabarov
|
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '0'
|
|
82
82
|
requirements: []
|
|
83
|
-
rubygems_version: 4.0.
|
|
83
|
+
rubygems_version: 4.0.23
|
|
84
84
|
specification_version: 4
|
|
85
85
|
summary: ActionView helper to render currently active links
|
|
86
86
|
test_files: []
|