idy 1.1.0 → 1.2.0
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/CHANGELOG.md +34 -15
- data/README.md +27 -6
- data/lib/idy/extension.rb +1 -1
- data/lib/idy/version.rb +1 -1
- metadata +25 -48
- data/spec/lib/idy/extension/findy_bump_spec.rb +0 -26
- data/spec/lib/idy/extension/findy_spec.rb +0 -24
- data/spec/lib/idy/extension/idy_decode_spec.rb +0 -37
- data/spec/lib/idy/extension/idy_default_salt_spec.rb +0 -11
- data/spec/lib/idy/extension/idy_encode_spec.rb +0 -50
- data/spec/lib/idy/extension/idy_spec.rb +0 -11
- data/spec/lib/idy/extension/options_spec.rb +0 -17
- data/spec/lib/idy/extension/salt_spec.rb +0 -21
- data/spec/lib/idy/extension/to_param_spec.rb +0 -51
- data/spec/rails_helper.rb +0 -27
- data/spec/support/common.rb +0 -11
- data/spec/support/database_cleaner.rb +0 -21
- data/spec/support/db/migrate/create_tables.rb +0 -29
- data/spec/support/migrate.rb +0 -5
- data/spec/support/models/abcdefghijklm.rb +0 -4
- data/spec/support/models/article.rb +0 -7
- data/spec/support/models/clean.rb +0 -4
- data/spec/support/models/comment.rb +0 -7
- data/spec/support/models/post.rb +0 -5
- data/spec/support/models/user.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c1011342e7f8209b6c228fd8942f1d4e5b95032a2e30d541d0440c9edc9c9b8
|
4
|
+
data.tar.gz: a3033d0cc45ddde615174dc662e1c33f21e24a33739d1e4ae7b7cfa454a993d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4972508e537e35f40bcc2126f738ffb31b1181e7d322d80375f1f7fce30dca31ca732130384017c22af25a7d1f74bcb0c344588adbaaffdd38ddd932910a1ea
|
7
|
+
data.tar.gz: b42199aa35fb78fb891e893ee3975964f1b02f84675ac0be0b7da6f9031732c8d1af5762fa8ab25d13b25070e9d22c1754da2e078285c42437465bc93e35e1dc
|
data/CHANGELOG.md
CHANGED
@@ -1,33 +1,52 @@
|
|
1
|
+
## v1.2.0
|
2
|
+
|
3
|
+
### Fixes
|
4
|
+
|
5
|
+
- Allows namespaced class to be obfuscated. [#10](https://github.com/wbotelhos/idy/pull/10) by [vitobotta](https://github.com/vitobotta)
|
6
|
+
|
7
|
+
### Updates
|
8
|
+
|
9
|
+
- Adds all previous version on the [Releases page](https://github.com/wbotelhos/idy/releases);
|
10
|
+
- Adds coverage via [Codecov](https://app.codecov.io/gh/wbotelhos/idy);
|
11
|
+
- Moves the CI to [Github Actions](https://github.com/wbotelhos/idy/actions);
|
12
|
+
- Removes spec files from the gem to keep the package smaller;
|
13
|
+
|
1
14
|
## v1.1.0
|
2
15
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
16
|
+
### Updates
|
17
|
+
|
18
|
+
- Does not restrict Rails version;
|
19
|
+
- Does not restrict Hashids version;
|
20
|
+
- Bump Ruby version to 2.6.4;
|
7
21
|
|
8
22
|
## v1.0.0
|
9
23
|
|
10
|
-
|
11
|
-
|
24
|
+
### Break Changes
|
25
|
+
|
26
|
+
- Drops `find` override method to avoid finding on a hash that looks like a number issue [#1](https://github.com/wbotelhos/idy/issues/1)
|
12
27
|
|
13
28
|
## v0.1.3
|
14
29
|
|
15
|
-
|
16
|
-
|
17
|
-
|
30
|
+
### Features
|
31
|
+
|
32
|
+
- Added `find` method to find directly via idy returning `nil` when the record is not found;
|
33
|
+
- Added `find!` method to find directly via idy raising an error when the record is not found.
|
34
|
+
|
35
|
+
### Fixes
|
18
36
|
|
19
|
-
-
|
20
|
-
- String that is integer like is not passed to original find method.
|
37
|
+
- String that is integer-like is not passed to the original find method.
|
21
38
|
|
22
39
|
## v0.1.2
|
23
40
|
|
24
|
-
|
25
|
-
|
41
|
+
### Fixes
|
42
|
+
|
43
|
+
- Set options on a prefixed var to avoid conflict.
|
26
44
|
|
27
45
|
## v0.1.1
|
28
46
|
|
29
|
-
|
30
|
-
|
47
|
+
### Fixes
|
48
|
+
|
49
|
+
- v0.1.0 had a problem with `push`.
|
31
50
|
|
32
51
|
## v0.1.0
|
33
52
|
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# Idy
|
2
2
|
|
3
|
-
[](https://github.com/wbotelhos/idy/actions)
|
4
4
|
[](https://badge.fury.io/rb/idy)
|
5
|
+
[](https://codeclimate.com/github/wbotelhos/idy/maintainability)
|
6
|
+
[](https://codecov.io/gh/wbotelhos/idy)
|
7
|
+
[](https://www.patreon.com/wbotelhos)
|
5
8
|
|
6
9
|
An ID obfuscator for ActiveRecord.
|
7
10
|
|
@@ -144,13 +147,31 @@ Article.findy! 'missing'
|
|
144
147
|
# ActiveRecord::RecordNotFound: Couldn't find Article with 'idy'="missing"
|
145
148
|
```
|
146
149
|
|
150
|
+
## Functions
|
151
|
+
|
152
|
+
You can encode a number manually:
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
Model.idy_encode(idy)
|
156
|
+
```
|
157
|
+
|
158
|
+
You can decode an idy in case you want to use the ActiveRecord methods with the original ID:
|
159
|
+
|
160
|
+
```ruby
|
161
|
+
Model.idy_decode(idy)
|
162
|
+
```
|
163
|
+
|
164
|
+
## Testing
|
165
|
+
Check if your model responds to idy method:
|
166
|
+
|
167
|
+
### RSpec
|
168
|
+
```ruby
|
169
|
+
it { is_expected.to respond_to(:idy) }
|
170
|
+
```
|
171
|
+
|
147
172
|
## Inspiration
|
148
173
|
|
149
|
-
It was
|
174
|
+
It was inspired and improved from:
|
150
175
|
|
151
176
|
- [obfuscate_id](https://github.com/namick/obfuscate_id)
|
152
177
|
- [hashids_uri](https://github.com/danieldraper/hashids_uri)
|
153
|
-
|
154
|
-
## Love it!
|
155
|
-
|
156
|
-
Via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=X8HEP2878NDEG&item_name=idy) or [Gratipay](https://liberapay.com/idy/donate). Thanks! (:
|
data/lib/idy/extension.rb
CHANGED
data/lib/idy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: idy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Washington Botelho
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: codecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: database_cleaner
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +140,10 @@ description: An ID obfuscator for ActiveRecord.
|
|
126
140
|
email: wbotelhos@gmail.com
|
127
141
|
executables: []
|
128
142
|
extensions: []
|
129
|
-
extra_rdoc_files:
|
143
|
+
extra_rdoc_files:
|
144
|
+
- CHANGELOG.md
|
145
|
+
- LICENSE
|
146
|
+
- README.md
|
130
147
|
files:
|
131
148
|
- CHANGELOG.md
|
132
149
|
- LICENSE
|
@@ -134,31 +151,11 @@ files:
|
|
134
151
|
- lib/idy.rb
|
135
152
|
- lib/idy/extension.rb
|
136
153
|
- lib/idy/version.rb
|
137
|
-
- spec/lib/idy/extension/findy_bump_spec.rb
|
138
|
-
- spec/lib/idy/extension/findy_spec.rb
|
139
|
-
- spec/lib/idy/extension/idy_decode_spec.rb
|
140
|
-
- spec/lib/idy/extension/idy_default_salt_spec.rb
|
141
|
-
- spec/lib/idy/extension/idy_encode_spec.rb
|
142
|
-
- spec/lib/idy/extension/idy_spec.rb
|
143
|
-
- spec/lib/idy/extension/options_spec.rb
|
144
|
-
- spec/lib/idy/extension/salt_spec.rb
|
145
|
-
- spec/lib/idy/extension/to_param_spec.rb
|
146
|
-
- spec/rails_helper.rb
|
147
|
-
- spec/support/common.rb
|
148
|
-
- spec/support/database_cleaner.rb
|
149
|
-
- spec/support/db/migrate/create_tables.rb
|
150
|
-
- spec/support/migrate.rb
|
151
|
-
- spec/support/models/abcdefghijklm.rb
|
152
|
-
- spec/support/models/article.rb
|
153
|
-
- spec/support/models/clean.rb
|
154
|
-
- spec/support/models/comment.rb
|
155
|
-
- spec/support/models/post.rb
|
156
|
-
- spec/support/models/user.rb
|
157
154
|
homepage: https://github.com/wbotelhos/idy
|
158
155
|
licenses:
|
159
156
|
- MIT
|
160
157
|
metadata: {}
|
161
|
-
post_install_message:
|
158
|
+
post_install_message:
|
162
159
|
rdoc_options: []
|
163
160
|
require_paths:
|
164
161
|
- lib
|
@@ -173,28 +170,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
170
|
- !ruby/object:Gem::Version
|
174
171
|
version: '0'
|
175
172
|
requirements: []
|
176
|
-
rubygems_version: 3.
|
177
|
-
signing_key:
|
173
|
+
rubygems_version: 3.2.22
|
174
|
+
signing_key:
|
178
175
|
specification_version: 4
|
179
176
|
summary: An ID obfuscator for ActiveRecord.
|
180
|
-
test_files:
|
181
|
-
- spec/support/migrate.rb
|
182
|
-
- spec/support/models/article.rb
|
183
|
-
- spec/support/models/abcdefghijklm.rb
|
184
|
-
- spec/support/models/clean.rb
|
185
|
-
- spec/support/models/comment.rb
|
186
|
-
- spec/support/models/post.rb
|
187
|
-
- spec/support/models/user.rb
|
188
|
-
- spec/support/common.rb
|
189
|
-
- spec/support/db/migrate/create_tables.rb
|
190
|
-
- spec/support/database_cleaner.rb
|
191
|
-
- spec/lib/idy/extension/idy_spec.rb
|
192
|
-
- spec/lib/idy/extension/to_param_spec.rb
|
193
|
-
- spec/lib/idy/extension/salt_spec.rb
|
194
|
-
- spec/lib/idy/extension/options_spec.rb
|
195
|
-
- spec/lib/idy/extension/idy_encode_spec.rb
|
196
|
-
- spec/lib/idy/extension/idy_decode_spec.rb
|
197
|
-
- spec/lib/idy/extension/findy_spec.rb
|
198
|
-
- spec/lib/idy/extension/findy_bump_spec.rb
|
199
|
-
- spec/lib/idy/extension/idy_default_salt_spec.rb
|
200
|
-
- spec/rails_helper.rb
|
177
|
+
test_files: []
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
RSpec.describe Article, '#findy!' do
|
6
|
-
context 'when a hash is given' do
|
7
|
-
context 'when record is found' do
|
8
|
-
let!(:record) { described_class.create id: 1 }
|
9
|
-
let!(:hash) { 'My' }
|
10
|
-
|
11
|
-
it 'finds the record' do
|
12
|
-
expect(described_class.findy!(hash)).to eq record
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'when record is not found' do
|
17
|
-
let!(:hash) { 'My' }
|
18
|
-
|
19
|
-
it 'raises' do
|
20
|
-
message = %(Couldn't find User with 'idy'="My")
|
21
|
-
|
22
|
-
expect { described_class.findy!(hash) }.to raise_error ActiveRecord::RecordNotFound, message
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
RSpec.describe Article, '#findy' do
|
6
|
-
context 'when a hash is given' do
|
7
|
-
context 'when record is found' do
|
8
|
-
let!(:record) { described_class.create id: 1 }
|
9
|
-
let!(:hash) { 'My' }
|
10
|
-
|
11
|
-
it 'finds the record' do
|
12
|
-
expect(described_class.findy(hash)).to eq record
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'when record is not found' do
|
17
|
-
let!(:hash) { 'My' }
|
18
|
-
|
19
|
-
it 'returns nil' do
|
20
|
-
expect(described_class.findy(hash)).to be_nil
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
RSpec.describe Article, '#idy_decode' do
|
6
|
-
context 'with no given salt' do
|
7
|
-
it 'undos the obfuscation of id with default class salt' do
|
8
|
-
expect(described_class.idy_decode('My')).to eq 1
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'with empty salt' do
|
13
|
-
let!(:salt) { '' }
|
14
|
-
|
15
|
-
it 'undos the obfuscation of id with given salt' do
|
16
|
-
expect(described_class.idy_decode('jR', salt: salt)).to eq 1
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
context 'with salt' do
|
21
|
-
context 'when is string' do
|
22
|
-
let!(:salt) { 'salt' }
|
23
|
-
|
24
|
-
it 'undos the obfuscation of id with given salt' do
|
25
|
-
expect(described_class.idy_decode('XG', salt: salt)).to eq 1
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context 'when is number' do
|
30
|
-
let!(:salt) { 1 }
|
31
|
-
|
32
|
-
it 'undos the obfuscation of id with given salt as string' do
|
33
|
-
expect(described_class.idy_decode('kL', salt: 1)).to eq 1
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
RSpec.describe Abcdefghijklm, '#idy_default_salt' do
|
6
|
-
context 'when class name has a big length' do
|
7
|
-
it 'is bases on the first 10 class letter position index on alphabet' do
|
8
|
-
expect(described_class.idy_default_salt).to eq '12345678910'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
RSpec.describe Article, '#idy_encode' do
|
6
|
-
context 'with no given salt' do
|
7
|
-
let!(:model) { described_class.new id: 1 }
|
8
|
-
|
9
|
-
it 'obfuscates the id with default class salt' do
|
10
|
-
expect(model.class.idy_encode(model.id)).to eq 'My'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'with empty salt' do
|
15
|
-
let!(:model) { described_class.new id: 1 }
|
16
|
-
let!(:salt) { '' }
|
17
|
-
|
18
|
-
it 'obfuscates the id with empty salt' do
|
19
|
-
expect(model.class.idy_encode(model.id, salt: salt)).to eq 'jR'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context 'with salt' do
|
24
|
-
let!(:model) { described_class.new id: 1 }
|
25
|
-
|
26
|
-
context 'when is string' do
|
27
|
-
let!(:salt) { 'salt' }
|
28
|
-
|
29
|
-
it 'obfuscates the id with given salt' do
|
30
|
-
expect(model.class.idy_encode(model.id, salt: salt)).to eq 'XG'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when is number' do
|
35
|
-
let!(:salt) { 1 }
|
36
|
-
|
37
|
-
it 'obfuscates the id with given salt as string' do
|
38
|
-
expect(model.class.idy_encode(model.id, salt: salt)).to eq 'kL'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'with nil id' do
|
44
|
-
let!(:model) { described_class.new }
|
45
|
-
|
46
|
-
it 'returns nil' do
|
47
|
-
expect(model.class.idy_encode(model.id)).to be_nil
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
RSpec.describe Article, '.idy_options' do
|
6
|
-
context 'when options is not given' do
|
7
|
-
it 'returns a default options with a salt generated based on model name' do
|
8
|
-
expect(described_class.idy_options).to eq(salt: article_default_salt)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'when salt is given' do
|
13
|
-
it 'returns a default options with a salt equal the given one' do
|
14
|
-
expect(Comment.idy_options).to eq(salt: 'salt')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
RSpec.describe Clean, ':salt' do
|
6
|
-
describe '#salt' do
|
7
|
-
before { allow(described_class).to receive(:idy_options).and_return(salt: :salty) }
|
8
|
-
|
9
|
-
it 'fetchs the salt options' do
|
10
|
-
expect(described_class.salt).to eq(:salty)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '.salt' do
|
15
|
-
before { allow(described_class).to receive(:salt).and_return :salt }
|
16
|
-
|
17
|
-
it 'delegates to class method' do
|
18
|
-
expect(described_class.new.salt).to eq :salt
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rails_helper'
|
4
|
-
|
5
|
-
RSpec.describe Clean, '.to_param' do
|
6
|
-
context 'when object does not acts as idy' do
|
7
|
-
subject { described_class.new id: 1 }
|
8
|
-
|
9
|
-
it 'behaves as default' do
|
10
|
-
expect(subject.to_param).to eq '1'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'when object acts as idy' do
|
15
|
-
context 'with no given salt' do
|
16
|
-
let!(:model_1) { Article.new id: 1 }
|
17
|
-
|
18
|
-
it 'generates a hash' do
|
19
|
-
expect(model_1.to_param).to eq 'My'
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'with comparison' do
|
23
|
-
let!(:model_2) { Post.new }
|
24
|
-
|
25
|
-
context 'with other object with same id' do
|
26
|
-
before { model_2.id = 1 }
|
27
|
-
|
28
|
-
it 'generates different hash' do
|
29
|
-
expect(model_1.to_param).not_to eq model_2.to_param
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when object is not persisted' do
|
35
|
-
context 'when has no id' do
|
36
|
-
subject { Article.new }
|
37
|
-
|
38
|
-
specify { expect(subject.to_param).to be_nil }
|
39
|
-
end
|
40
|
-
|
41
|
-
context 'when has id' do
|
42
|
-
subject { Article.new id: 1 }
|
43
|
-
|
44
|
-
it 'generates a hash' do
|
45
|
-
expect(model_1.to_param).to eq 'My'
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/spec/rails_helper.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
ENV['RAILS_ENV'] ||= 'test'
|
4
|
-
|
5
|
-
require 'active_record/railtie'
|
6
|
-
require 'idy'
|
7
|
-
require 'pry-byebug'
|
8
|
-
|
9
|
-
ActiveRecord::Base.establish_connection adapter: :sqlite3, database: ':memory:'
|
10
|
-
|
11
|
-
Dir[File.expand_path('support/**/*.rb', __dir__)].each { |file| require file }
|
12
|
-
|
13
|
-
def article_default_salt
|
14
|
-
'1182093125'
|
15
|
-
end
|
16
|
-
|
17
|
-
def clean_default_salt
|
18
|
-
'3125114'
|
19
|
-
end
|
20
|
-
|
21
|
-
def comment_default_salt
|
22
|
-
''
|
23
|
-
end
|
24
|
-
|
25
|
-
def user_default_salt
|
26
|
-
'1182093125'
|
27
|
-
end
|
data/spec/support/common.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'database_cleaner'
|
4
|
-
|
5
|
-
RSpec.configure do |config|
|
6
|
-
config.before :suite do
|
7
|
-
DatabaseCleaner.strategy = :transaction
|
8
|
-
|
9
|
-
DatabaseCleaner.clean_with :transaction
|
10
|
-
end
|
11
|
-
|
12
|
-
config.before do
|
13
|
-
DatabaseCleaner.start
|
14
|
-
end
|
15
|
-
|
16
|
-
config.around do |spec|
|
17
|
-
DatabaseCleaner.cleaning do
|
18
|
-
spec.run
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class CreateTables < ActiveRecord::Migration[5.0]
|
4
|
-
def change
|
5
|
-
create_table :abcdefghijklms do |t|
|
6
|
-
end
|
7
|
-
|
8
|
-
create_table :articles do |t|
|
9
|
-
t.string :title
|
10
|
-
end
|
11
|
-
|
12
|
-
create_table :cleans do |t|
|
13
|
-
end
|
14
|
-
|
15
|
-
create_table :comments do |t|
|
16
|
-
t.string :body
|
17
|
-
|
18
|
-
t.references :article, index: true, foreign_key: true
|
19
|
-
end
|
20
|
-
|
21
|
-
create_table :posts do |t|
|
22
|
-
t.string :title
|
23
|
-
end
|
24
|
-
|
25
|
-
create_table :users do |t|
|
26
|
-
t.string :name
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/spec/support/migrate.rb
DELETED
data/spec/support/models/post.rb
DELETED
data/spec/support/models/user.rb
DELETED