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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f31e4ef81bc22848b43dabaf6c9e598225abeb99
4
- data.tar.gz: c39be78affc2845c6b3f7b27aa7457bde9009d21
3
+ metadata.gz: 4a051d211d8538496f2cf15cc02be928632da95c
4
+ data.tar.gz: 0d58cd032dec960e2f956494c7486c541891bcb3
5
5
  SHA512:
6
- metadata.gz: dcbc891ae1a62a40b71bc57ce0e8056a4a43d4c96c136b92ba065dd428a3abeda9b692acb92b54a9d3ac9d8204f01f69d62d86f9d344275a2523c9073d5e41d4
7
- data.tar.gz: f54e6296e03ec9949e47a1eb09d73f98a94715fee6e2b606a564f8f4d89ffa974fd9db13093f27ed0679c7daaa7e253162482f7f05366f39cca39b2e4f9d03cd
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 desired path and redirect to it after logging in.
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.
@@ -2,7 +2,8 @@ require "go_to_param/version"
2
2
 
3
3
  module GoToParam
4
4
  def self.included(klass)
5
- klass.helper self
5
+ klass.helper_method :hidden_go_to_tag,
6
+ :go_to_hash, :build_go_to_hash
6
7
  end
7
8
 
8
9
  def hidden_go_to_tag
@@ -1,3 +1,3 @@
1
1
  module GoToParam
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -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.helper(mod)
7
- @helpers ||= []
8
- @helpers << mod
6
+ def self.helper_method(*methods)
7
+ @helper_methods = methods
9
8
  end
10
9
 
11
- def self.helpers
12
- @helpers
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" }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_to_param
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik N