go_to_param 0.0.6 → 0.0.8
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 -3
- data/lib/go_to_param.rb +2 -1
- data/lib/go_to_param/version.rb +1 -1
- data/spec/go_to_param_spec.rb +16 -9
- 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: 4a051d211d8538496f2cf15cc02be928632da95c
|
4
|
+
data.tar.gz: 0d58cd032dec960e2f956494c7486c541891bcb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b6945d80f86a4d8c7872b82407eade7a0df4d34425ab698d548fc943c5d4604462c7196a10eb3cf64d320636b0352af9c6358f02a80fa6f882e3207eba73614
|
7
|
+
data.tar.gz: c7d6e1d186f93dc4db2ae703577044c8515cfcbc90cc919cfa4b40f5d540123409cbf7e579099412969ed4f6edbdee1fbd5813c404bd3fe92daeb54ed5bcc0c0
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Small set of Rails "go_to" redirection parameter utilities.
|
4
4
|
|
5
|
-
E.g. to catch a
|
5
|
+
E.g. to catch a requested path and redirect to it after logging in or signing up.
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
@@ -16,8 +16,6 @@ end
|
|
16
16
|
|
17
17
|
Now your controllers and views get some methods.
|
18
18
|
|
19
|
-
All methods are made available in both controllers and views.
|
20
|
-
|
21
19
|
### build_go_to_hash
|
22
20
|
|
23
21
|
Put the current/requested path in a `?go_to=` parameter.
|
data/lib/go_to_param.rb
CHANGED
data/lib/go_to_param/version.rb
CHANGED
data/spec/go_to_param_spec.rb
CHANGED
@@ -3,13 +3,12 @@ require_relative "../lib/go_to_param"
|
|
3
3
|
class FakeController
|
4
4
|
attr_accessor :params, :view_context, :request
|
5
5
|
|
6
|
-
def self.
|
7
|
-
@
|
8
|
-
@helpers << mod
|
6
|
+
def self.helper_method(*methods)
|
7
|
+
@helper_methods = methods
|
9
8
|
end
|
10
9
|
|
11
|
-
def self.
|
12
|
-
@
|
10
|
+
def self.helper_methods
|
11
|
+
@helper_methods
|
13
12
|
end
|
14
13
|
|
15
14
|
include GoToParam
|
@@ -18,11 +17,11 @@ end
|
|
18
17
|
describe GoToParam do
|
19
18
|
let(:controller) { FakeController.new }
|
20
19
|
|
21
|
-
it "makes itself a helper module" do
|
22
|
-
FakeController.helpers.should include(GoToParam)
|
23
|
-
end
|
24
|
-
|
25
20
|
describe "#hidden_go_to_tag" do
|
21
|
+
it "becomes a helper method" do
|
22
|
+
FakeController.helper_methods.should include :hidden_go_to_tag
|
23
|
+
end
|
24
|
+
|
26
25
|
it "adds a hidden field tag" do
|
27
26
|
controller.params = { go_to: "/example", id: "1" }
|
28
27
|
view = double
|
@@ -35,6 +34,10 @@ describe GoToParam do
|
|
35
34
|
end
|
36
35
|
|
37
36
|
describe "#go_to_hash" do
|
37
|
+
it "becomes a helper method" do
|
38
|
+
FakeController.helper_methods.should include :go_to_hash
|
39
|
+
end
|
40
|
+
|
38
41
|
it "includes the go_to parameter" do
|
39
42
|
controller.params = { go_to: "/example", id: "1" }
|
40
43
|
|
@@ -49,6 +52,10 @@ describe GoToParam do
|
|
49
52
|
end
|
50
53
|
|
51
54
|
describe "#build_go_to_hash" do
|
55
|
+
it "becomes a helper method" do
|
56
|
+
FakeController.helper_methods.should include :build_go_to_hash
|
57
|
+
end
|
58
|
+
|
52
59
|
it "gets the request path as the go_to parameter" do
|
53
60
|
controller.request = double(get?: true, fullpath: "/example")
|
54
61
|
controller.build_go_to_hash.should == { go_to: "/example" }
|