spec/lib/idy/extension/idy_encode_spec.rb in idy-1.0.0 vs spec/lib/idy/extension/idy_encode_spec.rb in idy-1.1.0
- old
+ new
@@ -2,28 +2,28 @@
require 'rails_helper'
RSpec.describe Article, '#idy_encode' do
context 'with no given salt' do
- let!(:model) { Article.new id: 1 }
+ let!(:model) { described_class.new id: 1 }
it 'obfuscates the id with default class salt' do
expect(model.class.idy_encode(model.id)).to eq 'My'
end
end
context 'with empty salt' do
- let!(:model) { Article.new id: 1 }
+ let!(:model) { described_class.new id: 1 }
let!(:salt) { '' }
it 'obfuscates the id with empty salt' do
expect(model.class.idy_encode(model.id, salt: salt)).to eq 'jR'
end
end
context 'with salt' do
- let!(:model) { Article.new id: 1 }
+ let!(:model) { described_class.new id: 1 }
context 'when is string' do
let!(:salt) { 'salt' }
it 'obfuscates the id with given salt' do
@@ -39,10 +39,10 @@
end
end
end
context 'with nil id' do
- let!(:model) { Article.new }
+ let!(:model) { described_class.new }
it 'returns nil' do
expect(model.class.idy_encode(model.id)).to be_nil
end
end