spec/controllers/payanyway_controller_spec.rb in payanyway-1.2.1 vs spec/controllers/payanyway_controller_spec.rb in payanyway-1.2.2
- old
+ new
@@ -46,13 +46,24 @@
end
end
context 'when valid signature' do
it 'should and message to logger' do
- expect_any_instance_of(Payanyway::Controller).to receive(:check_implementation).and_return({amount: 12, state: :paid})
+ expect(Rails.logger).not_to receive(:info)
+ expect_any_instance_of(Payanyway::Controller).to receive(:check_implementation).and_return(amount: 12, state: :paid)
+
get :check, { 'MNT_TRANSACTION_ID' => 676, 'MNT_SIGNATURE' => '79c1c4f41a0a70bb107c976ebba25811' }
expect(Nokogiri::XML(response.body).at_css('MNT_RESPONSE')).to be_present
+ end
+ end
+
+ context 'when logger flag is true' do
+ it 'should add message to logger' do
+ expect(Rails.logger).to receive(:info).with(/PAYANYWAY: XML response for check/)
+
+ expect_any_instance_of(Payanyway::Controller).to receive(:check_implementation).and_return(amount: 12, state: :paid, logger: true)
+ get :check, { 'MNT_TRANSACTION_ID' => 676, 'MNT_SIGNATURE' => '79c1c4f41a0a70bb107c976ebba25811' }
end
end
end
end