Run rubocop --fix-layout and remove encoding comments

This commit is contained in:
Patrick Gansterer 2021-03-01 15:27:26 +01:00
parent fa63e6e81d
commit ea2862fdef
283 changed files with 1164 additions and 1969 deletions

View file

@ -6,12 +6,12 @@ describe TokenVerifier do
let (:msg) { v.generate }
it 'validates' do
expect{ v.verify(msg) }.to_not raise_error
expect { v.verify(msg) }.to_not raise_error
end
it 'validates when recreated' do
v2 = TokenVerifier.new(prefix)
expect{ v2.verify(msg) }.to_not raise_error
expect { v2.verify(msg) }.to_not raise_error
end
it 'does not validate with a different prefix' do
@ -25,20 +25,19 @@ describe TokenVerifier do
begin
FoodsoftConfig.scope = Faker::Lorem.words(number: 1)
v2 = TokenVerifier.new(prefix)
expect{ v2.verify(msg) }.to raise_error(TokenVerifier::InvalidScope)
expect { v2.verify(msg) }.to raise_error(TokenVerifier::InvalidScope)
ensure
FoodsoftConfig.scope = oldscope
end
end
it 'does not validate a random string' do
expect{ v.verify(Faker::Lorem.characters(number: 100)) }.to raise_error(ActiveSupport::MessageVerifier::InvalidSignature)
expect { v.verify(Faker::Lorem.characters(number: 100)) }.to raise_error(ActiveSupport::MessageVerifier::InvalidSignature)
end
it 'returns the message' do
data = [5, {'hi' => :there}, 'bye', []]
data = [5, { 'hi' => :there }, 'bye', []]
msg = v.generate(data)
expect(v.verify(msg)).to eq data
end
end