preserve 0.1.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,32 +2,39 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe Preserve, type: :request do
4
4
  it 'persists a parameter value' do
5
- get parameters_path, per_page: 20
5
+ get parameters_path, per_page: '20'
6
6
  get parameters_path
7
7
 
8
- expect(json[:per_page].to_i).to eq(20)
8
+ expect(json_response[:per_page]).to eq('20')
9
9
  end
10
10
 
11
11
  it 'updates a parameter value' do
12
- get parameters_path, per_page: 20
13
- get parameters_path, per_page: 10
12
+ get parameters_path, per_page: '20'
13
+ get parameters_path, per_page: '10'
14
14
 
15
- expect(json[:per_page].to_i).to eq(10)
15
+ expect(json_response[:per_page]).to eq('10')
16
16
  end
17
17
 
18
- it 'handles multiple arguments' do
19
- get parameters_path, per_page: 20, page: 5
18
+ it 'handles multiple parameters' do
19
+ get parameters_path, page: '5', per_page: '20'
20
20
  get parameters_path
21
21
 
22
- expect(json[:per_page].to_i).to eq(20)
23
- expect(json[:page].to_i).to eq(5)
22
+ expect(json_response[:page]).to eq('5')
23
+ expect(json_response[:per_page]).to eq('20')
24
24
  end
25
25
 
26
- it 'handles restrictions' do
27
- post parameters_path, per_page: 20
26
+ it 'handles action restrictions' do
27
+ post parameters_path, per_page: '20'
28
28
  post parameters_path
29
29
 
30
- expect(json[:per_page]).to be_nil
30
+ expect(json_response[:per_page]).to be_nil
31
+ end
32
+
33
+ it 'handles a blank parameter value' do
34
+ get parameters_path, status: 'active'
35
+ get parameters_path, status: ''
36
+
37
+ expect(json_response[:status]).to eq('')
31
38
  end
32
39
 
33
40
  it 'handles a session key prefix' do
@@ -41,6 +48,6 @@ RSpec.describe Preserve, type: :request do
41
48
  get parameters_path, locale: 'en'
42
49
  get parameters_path
43
50
 
44
- expect(json[:locale]).to eq('en')
51
+ expect(json_response[:locale]).to eq('en')
45
52
  end
46
53
  end
@@ -1,12 +1,11 @@
1
1
  ENV['RAILS_ENV'] ||= 'test'
2
2
 
3
- require File.expand_path('../dummy/config/environment.rb', __FILE__)
3
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
4
4
 
5
5
  require 'rspec/rails'
6
6
 
7
7
  Rails.backtrace_cleaner.remove_silencers!
8
8
 
9
- # Load support files
10
9
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
10
 
12
11
  RSpec.configure do |config|
@@ -1,5 +1,7 @@
1
1
  module RequestHelpers
2
- def json
3
- @json ||= JSON.parse(response.body).with_indifferent_access
2
+ def json_response
3
+ @json_response ||= begin
4
+ JSON.parse(response.body).with_indifferent_access
5
+ end
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: preserve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bartosz Pieńkowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-17 00:00:00.000000000 Z
11
+ date: 2020-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -25,48 +25,62 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sqlite3
28
+ name: appraisal
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3.13
33
+ version: '2.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.3.13
40
+ version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.9'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3.9'
55
55
  - !ruby/object:Gem::Dependency
56
- name: appraisal
56
+ name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.50.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
69
- description: Preserve is a Rails plugin which stores selected parameters in a session
68
+ version: 0.50.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.3.13
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.3.13
83
+ description: Preserve is a Rails plugin which stores selected parameters in the session
70
84
  to make them available in subsequent requests.
71
85
  email: pienkowb@gmail.com
72
86
  executables: []
@@ -130,15 +144,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
130
144
  requirements:
131
145
  - - ">="
132
146
  - !ruby/object:Gem::Version
133
- version: 1.9.3
147
+ version: 2.0.0
134
148
  required_rubygems_version: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - ">="
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
153
  requirements: []
140
- rubyforge_project:
141
- rubygems_version: 2.7.9
154
+ rubygems_version: 3.0.6
142
155
  signing_key:
143
156
  specification_version: 4
144
157
  summary: Persist parameter values between requests