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