-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from tvdeyen/add-payment_method_parent_class
Add payment method parent class
- Loading branch information
Showing
10 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
/pkg/ | ||
/spec/reports/ | ||
/tmp/ | ||
/log/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
sudo: false | ||
language: ruby | ||
dist: trusty | ||
cache: | ||
bundler: true | ||
before_install: | ||
- "gem install bundler --pre" | ||
- "bundler -v" | ||
rvm: | ||
- 2.4.2 | ||
env: | ||
matrix: | ||
- SOLIDUS_BRANCH=v1.0 | ||
- SOLIDUS_BRANCH=v1.1 | ||
- SOLIDUS_BRANCH=v1.2 | ||
- SOLIDUS_BRANCH=v1.3 | ||
- SOLIDUS_BRANCH=v1.4 | ||
- SOLIDUS_BRANCH=v2.0 | ||
- SOLIDUS_BRANCH=v2.1 | ||
- SOLIDUS_BRANCH=v2.2 | ||
- SOLIDUS_BRANCH=v2.3 | ||
- SOLIDUS_BRANCH=v2.4 | ||
- SOLIDUS_BRANCH=master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
source 'https://rubygems.org' | ||
|
||
branch = ENV.fetch('SOLIDUS_BRANCH', 'master') | ||
gem 'solidus', github: 'solidusio/solidus', branch: branch | ||
gem 'solidus_core', github: 'solidusio/solidus', branch: branch | ||
|
||
# Specify your gem's dependencies in solidus_support.gemspec | ||
gemspec | ||
|
||
gem 'sqlite3' | ||
gem 'sprockets-rails' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
RSpec.describe SolidusSupport do | ||
describe '.payment_method_parent_class' do | ||
subject { described_class.payment_method_parent_class(credit_card: credit_card) } | ||
|
||
let(:credit_card) { nil } | ||
|
||
it { is_expected.to eq(Spree::PaymentMethod) } | ||
|
||
context 'with credit_card: true' do | ||
let(:credit_card) { true } | ||
|
||
before do | ||
expect(described_class).to receive(:solidus_gem_version) do | ||
Gem::Version.new(solidus_version) | ||
end | ||
end | ||
|
||
context 'For Solidus < 2.3' do | ||
let(:solidus_version) { '2.2.x' } | ||
it { is_expected.to eq(Spree::Gateway) } | ||
end | ||
|
||
context 'For Solidus >= 2.3' do | ||
let(:solidus_version) { '2.3.x' } | ||
it { is_expected.to eq(Spree::PaymentMethod::CreditCard) } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require_relative 'support/dummy_app' | ||
require 'solidus_support/extension/spec_helper' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ENV['RAILS_ENV'] = 'test' | ||
ENV['DISABLE_DATABASE_ENVIRONMENT_CHECK'] = '1' | ||
|
||
Bundler.setup | ||
|
||
require 'rails' | ||
require 'solidus_core' | ||
|
||
Bundler.require(:default, :test) | ||
|
||
module DummyApp | ||
class Application < ::Rails::Application | ||
config.eager_load = false | ||
config.paths["config/database"] = File.expand_path('../dummy_app/database.yml', __FILE__) | ||
end | ||
end | ||
|
||
DummyApp::Application.initialize! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
test: | ||
adapter: sqlite3 | ||
database: ':memory:' | ||
timeout: 10000 |