-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add payment method parent class #8
Merged
kennyadsl
merged 3 commits into
solidusio:master
from
tvdeyen:add-payment_method_parent_class
Oct 9, 2018
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is only useful when
credit_card
istrue
(otherwise it isSpree::PaymentMethod
in all versions).Maybe we should call this
credit_card_payment_method_parent_class
instead, and only deal with that case?Either way 👍