go_to_param 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67519694e42e40bb318a582f636068d78db28f8b
4
- data.tar.gz: cc6f2d10a2e614c6f9608166b9f366e0edaf266c
3
+ metadata.gz: f31e4ef81bc22848b43dabaf6c9e598225abeb99
4
+ data.tar.gz: c39be78affc2845c6b3f7b27aa7457bde9009d21
5
5
  SHA512:
6
- metadata.gz: 1d9044c27b4633755d1a5c079c66f36520fdd49eafcdd005c4100d886005c1c9c38d751e161576eb997cbf682308d2d806ada5a0997d4a10b8517adc2e2d81b9
7
- data.tar.gz: 9b53e109c7f0b7ea51e352a3cac41c3af1540c71f824f5f124e97a3ba69c5ec136c27d3387a0646f3b6976400f0fa3e87a15881b5854670dc78a34ac4f255cc7
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, e.g. to catch a desired path and redirect to it after logging in.
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.
@@ -1,3 +1,3 @@
1
1
  module GoToParam
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/go_to_param.rb CHANGED
@@ -2,7 +2,7 @@ require "go_to_param/version"
2
2
 
3
3
  module GoToParam
4
4
  def self.included(klass)
5
- klass.helper_method :hidden_go_to_tag, :go_to_hash
5
+ klass.helper self
6
6
  end
7
7
 
8
8
  def hidden_go_to_tag
@@ -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.helper_method(*methods)
7
- @helper_methods = methods
6
+ def self.helper(mod)
7
+ @helpers ||= []
8
+ @helpers << mod
8
9
  end
9
10
 
10
- def self.helper_methods
11
- @helper_methods
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
- describe "#hidden_go_to_tag" do
21
- it "makes it a helper method" do
22
- FakeController.helper_methods.should include :hidden_go_to_tag
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
 
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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik N