go_to_param 0.0.5 → 0.0.6
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 +5 -1
- data/lib/go_to_param/version.rb +1 -1
- data/lib/go_to_param.rb +1 -1
- data/spec/go_to_param_spec.rb +9 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f31e4ef81bc22848b43dabaf6c9e598225abeb99
|
4
|
+
data.tar.gz: c39be78affc2845c6b3f7b27aa7457bde9009d21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcbc891ae1a62a40b71bc57ce0e8056a4a43d4c96c136b92ba065dd428a3abeda9b692acb92b54a9d3ac9d8204f01f69d62d86f9d344275a2523c9073d5e41d4
|
7
|
+
data.tar.gz: f54e6296e03ec9949e47a1eb09d73f98a94715fee6e2b606a564f8f4d89ffa974fd9db13093f27ed0679c7daaa7e253162482f7f05366f39cca39b2e4f9d03cd
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# GoToParam
|
2
2
|
|
3
|
-
Small set of Rails "go_to" redirection parameter utilities
|
3
|
+
Small set of Rails "go_to" redirection parameter utilities.
|
4
|
+
|
5
|
+
E.g. to catch a desired path and redirect to it after logging in.
|
4
6
|
|
5
7
|
## Usage
|
6
8
|
|
@@ -14,6 +16,8 @@ end
|
|
14
16
|
|
15
17
|
Now your controllers and views get some methods.
|
16
18
|
|
19
|
+
All methods are made available in both controllers and views.
|
20
|
+
|
17
21
|
### build_go_to_hash
|
18
22
|
|
19
23
|
Put the current/requested path in a `?go_to=` parameter.
|
data/lib/go_to_param/version.rb
CHANGED
data/lib/go_to_param.rb
CHANGED
data/spec/go_to_param_spec.rb
CHANGED
@@ -3,12 +3,13 @@ require_relative "../lib/go_to_param"
|
|
3
3
|
class FakeController
|
4
4
|
attr_accessor :params, :view_context, :request
|
5
5
|
|
6
|
-
def self.
|
7
|
-
@
|
6
|
+
def self.helper(mod)
|
7
|
+
@helpers ||= []
|
8
|
+
@helpers << mod
|
8
9
|
end
|
9
10
|
|
10
|
-
def self.
|
11
|
-
@
|
11
|
+
def self.helpers
|
12
|
+
@helpers
|
12
13
|
end
|
13
14
|
|
14
15
|
include GoToParam
|
@@ -17,11 +18,11 @@ end
|
|
17
18
|
describe GoToParam do
|
18
19
|
let(:controller) { FakeController.new }
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
21
|
+
it "makes itself a helper module" do
|
22
|
+
FakeController.helpers.should include(GoToParam)
|
23
|
+
end
|
24
24
|
|
25
|
+
describe "#hidden_go_to_tag" do
|
25
26
|
it "adds a hidden field tag" do
|
26
27
|
controller.params = { go_to: "/example", id: "1" }
|
27
28
|
view = double
|
@@ -34,10 +35,6 @@ describe GoToParam do
|
|
34
35
|
end
|
35
36
|
|
36
37
|
describe "#go_to_hash" do
|
37
|
-
it "makes it a helper method" do
|
38
|
-
FakeController.helper_methods.should include :go_to_hash
|
39
|
-
end
|
40
|
-
|
41
38
|
it "includes the go_to parameter" do
|
42
39
|
controller.params = { go_to: "/example", id: "1" }
|
43
40
|
|