Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Some small spec fixes #53

Merged
merged 3 commits into from
Jan 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions spec/models/solidus_paypal_braintree/gateway_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
end

it 'can complete an order' do
order.payments.reset

expect(order.total).to eq 55

expect(payment.capture_events.count).to eq 0
Expand Down
18 changes: 9 additions & 9 deletions spec/models/solidus_paypal_braintree/source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
subject { described_class.new.can_capture?(payment) }

context "when the payment state is pending" do
let(:payment) { build_stubbed(:payment, state: "pending") }
let(:payment) { build(:payment, state: "pending") }

it { is_expected.to be }
end

context "when the payment state is checkout" do
let(:payment) { build_stubbed(:payment, state: "checkout") }
let(:payment) { build(:payment, state: "checkout") }

it { is_expected.to be }
end

context "when the payment is completed" do
let(:payment) { build_stubbed(:payment, state: "completed") }
let(:payment) { build(:payment, state: "completed") }

it { is_expected.to_not be }
end
Expand All @@ -45,19 +45,19 @@
subject { described_class.new.can_void?(payment) }

context "when the payment failed" do
let(:payment) { build_stubbed(:payment, state: "failed") }
let(:payment) { build(:payment, state: "failed") }

it { is_expected.not_to be }
end

context "when the payment is already voided" do
let(:payment) { build_stubbed(:payment, state: "void") }
let(:payment) { build(:payment, state: "void") }

it { is_expected.not_to be }
end

context "when the payment is completed" do
let(:payment) { build_stubbed(:payment, state: "completed") }
let(:payment) { build(:payment, state: "completed") }

it { is_expected.to be }
end
Expand All @@ -68,20 +68,20 @@

context "when the payment is completed" do
context "and the credit allowed is 100" do
let(:payment) { build_stubbed(:payment, state: "completed", amount: 100) }
let(:payment) { build(:payment, state: "completed", amount: 100) }

it { is_expected.to be }
end

context "and the credit allowed is 0" do
let(:payment) { build_stubbed(:payment, state: "completed", amount: 0) }
let(:payment) { build(:payment, state: "completed", amount: 0) }

it { is_expected.not_to be }
end
end

context "when the payment has not been completed" do
let(:payment) { build_stubbed(:payment, state: "checkout") }
let(:payment) { build(:payment, state: "checkout") }

it { is_expected.not_to be }
end
Expand Down
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
require 'capybara/poltergeist'
Capybara.register_driver :poltergeist do |app|
# Paypal requires TLS v1.2 for ssl connections
Capybara::Poltergeist::Driver.new(app, { phantomjs_options: ['--ssl-protocol=tlsv1.2'] })
Capybara::Poltergeist::Driver.new(app, {
phantomjs_logger: Rails.logger,
phantomjs_options: ['--ssl-protocol=tlsv1.2']
})
end
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
Expand Down