Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
Fixes test expectations by passing a hash explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
philnash committed Apr 4, 2022
1 parent 160f0e1 commit fd0c466
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions spec/controllers/devise_authy_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@

describe "with a valid token" do
before(:each) {
expect(Authy::API).to receive(:verify).with(
expect(Authy::API).to receive(:verify).with({
:id => user.authy_id,
:token => valid_authy_token,
:force => true
).and_return(verify_success)
}).and_return(verify_success)
}

describe "without remembering" do
Expand Down Expand Up @@ -200,11 +200,11 @@

describe "with an invalid token" do
before(:each) {
expect(Authy::API).to receive(:verify).with(
expect(Authy::API).to receive(:verify).with({
:id => user.authy_id,
:token => invalid_authy_token,
:force => true
).and_return(verify_failure)
}).and_return(verify_failure)
post :POST_verify_authy, params: { :token => invalid_authy_token }
}

Expand Down Expand Up @@ -232,11 +232,11 @@
end

it 'locks the account when failed_attempts exceeds maximum' do
expect(Authy::API).to receive(:verify).exactly(Devise.maximum_attempts).times.with(
expect(Authy::API).to receive(:verify).exactly(Devise.maximum_attempts).times.with({
:id => lockable_user.authy_id,
:token => invalid_authy_token,
:force => true
).and_return(verify_failure)
}).and_return(verify_failure)
(Devise.maximum_attempts).times do
post :POST_verify_authy, params: { token: invalid_authy_token }
end
Expand All @@ -251,11 +251,11 @@
request.session['user_id'] = user.id
request.session['user_password_checked'] = true

expect(Authy::API).to receive(:verify).exactly(Devise.maximum_attempts).times.with(
expect(Authy::API).to receive(:verify).exactly(Devise.maximum_attempts).times.with({
:id => user.authy_id,
:token => invalid_authy_token,
:force => true
).and_return(verify_failure)
}).and_return(verify_failure)

Devise.maximum_attempts.times do
post :POST_verify_authy, params: { token: invalid_authy_token }
Expand Down Expand Up @@ -572,11 +572,11 @@

describe "successful verification" do
before(:each) do
expect(Authy::API).to receive(:verify).with(
expect(Authy::API).to receive(:verify).with({
:id => user.authy_id,
:token => token,
:force => true
).and_return(double("Authy::Response", :ok? => true))
}).and_return(double("Authy::Response", :ok? => true))
post :POST_verify_authy_installation, :params => { :token => token, :remember_device => '0' }
end

Expand All @@ -601,11 +601,11 @@

describe "successful verification with remember device" do
before(:each) do
expect(Authy::API).to receive(:verify).with(
expect(Authy::API).to receive(:verify).with({
:id => user.authy_id,
:token => token,
:force => true
).and_return(double("Authy::Response", :ok? => true))
}).and_return(double("Authy::Response", :ok? => true))
post :POST_verify_authy_installation, :params => { :token => token, :remember_device => '1' }
end

Expand All @@ -632,11 +632,11 @@

describe "unsuccessful verification" do
before(:each) do
expect(Authy::API).to receive(:verify).with(
expect(Authy::API).to receive(:verify).with({
:id => user.authy_id,
:token => token,
:force => true
).and_return(double("Authy::Response", :ok? => false))
}).and_return(double("Authy::Response", :ok? => false))
post :POST_verify_authy_installation, :params => { :token => token }
end

Expand All @@ -661,11 +661,11 @@
end

it "should hit API for a QR code" do
expect(Authy::API).to receive(:verify).with(
expect(Authy::API).to receive(:verify).with({
:id => user.authy_id,
:token => token,
:force => true
).and_return(double("Authy::Response", :ok? => false))
}).and_return(double("Authy::Response", :ok? => false))
expect(Authy::API).to receive(:request_qr_code).with(
:id => user.authy_id
).and_return(double("Authy::Request", :qr_code => 'https://example.com/qr.png'))
Expand Down

0 comments on commit fd0c466

Please sign in to comment.