go_to_param 1.1.2 → 1.1.3

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
  SHA256:
3
- metadata.gz: 9a103b9617231ac26d4b5e82ca46dea4bcfd961cbda378476113d3dcd5ab7303
4
- data.tar.gz: 0d805e34c66359b35775edc1e77ac9246b8f5d3b9838755d748f4c3acd1ae44b
3
+ metadata.gz: a8742769791ea66237e5decb3e329ed1c2b6a127f072378487b134f45cd8b7a9
4
+ data.tar.gz: cf8134a2f905e96b8e143c67ccae9f931d109c6c6570a6d46b64d4a329275904
5
5
  SHA512:
6
- metadata.gz: 04434b980320f4f2ed8522e9e059973b31b1eb2f5bacb9ad3be482a8e72ddafa859f3974a4385702f973111e25b005377c3865c2696f57f85f0399c1ddf4e1d0
7
- data.tar.gz: c7d4929d8f99b889b6680fe3c3383c5bad5d092ddb6d64e0dd704882062360c78f15331a8d4e5764e8731b89f73e3fd32229b5ff90dd9a82bdc5d1e012fe000a
6
+ metadata.gz: 1366c2d13bb1cba9f3147eadaa3a092526f70da496a642162a4e0e54da880b095b99335f24a3214ef72dc1fea834a2d0208c801020fefa4218c889d9bfc791e8
7
+ data.tar.gz: c74471045b18e7f076df5eccd804d31e1198064aa8affdf89518af07b420955d96701bcb1469ef8709037e2d306d6589115ac16be9cfec66a054179527b355a9
@@ -1,3 +1,3 @@
1
1
  module GoToParam
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_to_param
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik N
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-01 00:00:00.000000000 Z
11
+ date: 2021-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,27 +52,23 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description:
55
+ description:
56
56
  email:
57
57
  - henrik@nyh.se
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - ".gitignore"
63
62
  - CHANGELOG.md
64
- - Gemfile
65
63
  - README.md
66
- - Rakefile
67
- - go_to_param.gemspec
68
64
  - lib/go_to_param.rb
69
65
  - lib/go_to_param/version.rb
70
- - spec/go_to_param_spec.rb
71
66
  homepage: ''
72
67
  licenses:
73
68
  - MIT
74
- metadata: {}
75
- post_install_message:
69
+ metadata:
70
+ rubygems_mfa_required: 'true'
71
+ post_install_message:
76
72
  rdoc_options: []
77
73
  require_paths:
78
74
  - lib
@@ -87,9 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
83
  - !ruby/object:Gem::Version
88
84
  version: '0'
89
85
  requirements: []
90
- rubygems_version: 3.1.2
91
- signing_key:
86
+ rubygems_version: 3.2.31
87
+ signing_key:
92
88
  specification_version: 4
93
89
  summary: Rails "go_to" redirection param utilities.
94
- test_files:
95
- - spec/go_to_param_spec.rb
90
+ test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in go_to_param.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
data/go_to_param.gemspec DELETED
@@ -1,22 +0,0 @@
1
- lib = File.expand_path('../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'go_to_param/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "go_to_param"
7
- spec.version = GoToParam::VERSION
8
- spec.authors = ["Henrik N"]
9
- spec.email = ["henrik@nyh.se"]
10
- spec.summary = %q{Rails "go_to" redirection param utilities.}
11
- spec.homepage = ""
12
- spec.license = "MIT"
13
-
14
- spec.files = `git ls-files`.split($/)
15
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
- spec.require_paths = ["lib"]
18
-
19
- spec.add_development_dependency "bundler", ">= 1.3"
20
- spec.add_development_dependency "rake"
21
- spec.add_development_dependency "rspec"
22
- end
@@ -1,172 +0,0 @@
1
- require_relative "../lib/go_to_param"
2
-
3
- describe GoToParam do
4
- let(:controller_klass) do
5
- Class.new do
6
- attr_accessor :params, :view_context, :request
7
-
8
- def self.helper_method(*methods)
9
- @helper_methods = methods
10
- end
11
-
12
- def self.helper_methods
13
- @helper_methods
14
- end
15
-
16
- include GoToParam
17
- end
18
- end
19
-
20
- after { GoToParam.reset_allowed_redirect_prefixes }
21
-
22
- let(:controller) { controller_klass.new }
23
-
24
- describe "#hidden_go_to_tag" do
25
- it "becomes a helper method" do
26
- expect(controller_klass.helper_methods).to include :hidden_go_to_tag
27
- end
28
-
29
- it "adds a hidden field tag" do
30
- controller.params = { go_to: "/example", id: "1" }
31
- view = double
32
- controller.view_context = view
33
-
34
- expect(view).to receive(:hidden_field_tag).with(:go_to, "/example")
35
- controller.hidden_go_to_tag
36
- end
37
- end
38
-
39
- describe "#hidden_go_to_here_tag" do
40
- it "becomes a helper method" do
41
- expect(controller_klass.helper_methods).to include :hidden_go_to_here_tag
42
- end
43
-
44
- it "adds a hidden field tag" do
45
- controller.request = double(get?: true, fullpath: "/example")
46
- view = double
47
- controller.view_context = view
48
-
49
- expect(view).to receive(:hidden_field_tag).with(:go_to, "/example")
50
- controller.hidden_go_to_here_tag
51
- end
52
-
53
- # Tested in more detail in #go_to_here_params.
54
- it "accepts additional query parameters" do
55
- controller.request = double(get?: true, fullpath: "/example?a=1")
56
- view = double
57
- controller.view_context = view
58
-
59
- expect(view).to receive(:hidden_field_tag).with(:go_to, "/example?a=1&b=1+2")
60
- controller.hidden_go_to_here_tag(b: "1 2")
61
- end
62
- end
63
-
64
- describe "#go_to_params" do
65
- it "becomes a helper method" do
66
- expect(controller_klass.helper_methods).to include :go_to_params
67
- end
68
-
69
- it "includes the go_to parameter" do
70
- controller.params = { go_to: "/example", id: "1" }
71
-
72
- expect(controller.go_to_params).to eq({ go_to: "/example" })
73
- end
74
-
75
- it "accepts additional parameters" do
76
- controller.params = { go_to: "/example", id: "1" }
77
-
78
- expect(controller.go_to_params(a: "b")).to eq({ go_to: "/example", a: "b" })
79
- end
80
- end
81
-
82
- describe "#go_to_here_params" do
83
- it "becomes a helper method" do
84
- expect(controller_klass.helper_methods).to include :go_to_here_params
85
- end
86
-
87
- it "gets the request path as the go_to parameter" do
88
- controller.request = double(get?: true, fullpath: "/example")
89
- expect(controller.go_to_here_params).to eq({ go_to: "/example" })
90
- end
91
-
92
- it "returns an empty hash for a non-GET request" do
93
- controller.request = double(get?: false, fullpath: "/example")
94
- expect(controller.go_to_here_params).to eq({})
95
- end
96
-
97
- it "accepts additional query parameters" do
98
- controller.request = double(get?: true, fullpath: "/example")
99
- expect(controller.go_to_here_params(foo: "1 2", bar: 3)).to eq({ go_to: "/example?foo=1+2&bar=3" })
100
-
101
- # Handles pre-existing "?"
102
- controller.request = double(get?: true, fullpath: "/example?foo")
103
- expect(controller.go_to_here_params(bar: 3)).to eq({ go_to: "/example?foo&bar=3" })
104
- end
105
-
106
- it "accepts an anchor parameter" do
107
- controller.request = double(get?: true, fullpath: "/example")
108
- expect(controller.go_to_here_params(foo: "foo", anchor: "bar")).to eq({ go_to: "/example?foo=foo#bar" })
109
- end
110
-
111
- it "makes sure the go_to path is valid UTF-8" do
112
- weird_path = "\xE0\x80\x80weird\330stuff".force_encoding("ASCII-8BIT")
113
- replacement = "\uFFFD" # The Unicode "Replacement Character".
114
-
115
- controller.request = double(get?: true, fullpath: weird_path)
116
-
117
- go_to_value = controller.go_to_here_params[:go_to]
118
-
119
- expect(go_to_value.encoding).to eq(Encoding::UTF_8)
120
- expect(go_to_value).to eq("#{replacement}#{replacement}#{replacement}weird#{replacement}stuff")
121
- end
122
- end
123
-
124
- describe "#go_to_path" do
125
- it "becomes a helper method" do
126
- expect(controller_klass.helper_methods).to include :go_to_path
127
- end
128
-
129
- it "is the go_to parameter value" do
130
- controller.params = { go_to: "/example", id: "1" }
131
- expect(controller.go_to_path).to eq("/example")
132
- end
133
-
134
- it "is nil if the parameter value is not a relative path" do
135
- controller.params = { go_to: "http://evil.com", id: "1" }
136
- expect(controller.go_to_path).to be_nil
137
- end
138
-
139
- it "is nil when given a hash" do
140
- controller.params = { go_to: { evil: "true" }, id: "1" }
141
- expect(controller.go_to_path).to be_nil
142
- end
143
-
144
- it "respects custom allowed redirect prefixes" do
145
- GoToParam.allow_redirect_prefix("myapp://")
146
-
147
- controller.params = { go_to: "myapp://", id: "1" }
148
- expect(controller.go_to_path).to eq("myapp://")
149
- end
150
- end
151
-
152
- describe "#go_to_path_or" do
153
- it "becomes a helper method" do
154
- expect(controller_klass.helper_methods).to include :go_to_path_or
155
- end
156
-
157
- it "is the go_to parameter value" do
158
- controller.params = { go_to: "/example", id: "1" }
159
- expect(controller.go_to_path_or("/default")).to eq("/example")
160
- end
161
-
162
- it "falls back if the go_to param is blank" do
163
- controller.params = { go_to: "", id: "1" }
164
- expect(controller.go_to_path_or("/default")).to eq("/default")
165
- end
166
-
167
- it "falls back if the go_to param is not allowed" do
168
- controller.params = { go_to: "http://evil.com", id: "1" }
169
- expect(controller.go_to_path_or("/default")).to eq("/default")
170
- end
171
- end
172
- end