spec/lib/idy/extension/idy_encode_spec.rb in idy-0.1.3 vs spec/lib/idy/extension/idy_encode_spec.rb in idy-1.0.0
- old
+ new
@@ -1,10 +1,10 @@
# frozen_string_literal: true
require 'rails_helper'
-RSpec.describe '#idy_encode' do
+RSpec.describe Article, '#idy_encode' do
context 'with no given salt' do
let!(:model) { Article.new id: 1 }
it 'obfuscates the id with default class salt' do
expect(model.class.idy_encode(model.id)).to eq 'My'
@@ -21,18 +21,18 @@
end
context 'with salt' do
let!(:model) { Article.new id: 1 }
- context 'as string' do
+ context 'when is string' do
let!(:salt) { 'salt' }
it 'obfuscates the id with given salt' do
expect(model.class.idy_encode(model.id, salt: salt)).to eq 'XG'
end
end
- context 'as number' do
+ context 'when is number' do
let!(:salt) { 1 }
it 'obfuscates the id with given salt as string' do
expect(model.class.idy_encode(model.id, salt: salt)).to eq 'kL'
end