Skip to content

Commit 9eaca73

Browse files
authored
Merge pull request #2 from adammathys/minor-fixups
Some minor clean-up
2 parents a9ccb3a + fe28998 commit 9eaca73

File tree

8 files changed

+37
-43
lines changed

8 files changed

+37
-43
lines changed

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,11 @@ script:
66
- bundle exec rake
77
rvm:
88
- 2.1.5
9+
env:
10+
matrix:
11+
- SOLIDUS_BRANCH=v1.1
12+
- SOLIDUS_BRANCH=v1.2
13+
- SOLIDUS_BRANCH=v1.3
14+
- SOLIDUS_BRANCH=v1.4
15+
- SOLIDUS_BRANCH=v2.0
16+
- SOLIDUS_BRANCH=master

Gemfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
source 'https://rubygems.org'
22

3-
gem 'solidus', github: 'solidusio/solidus'
3+
branch = ENV.fetch("SOLIDUS_BRANCH", "master")
4+
gem 'solidus', github: 'solidusio/solidus', branch: branch
5+
6+
if branch == "master" || branch >= "v2.0"
7+
gem "rails-controller-testing", group: :test
8+
end
9+
410
# Provides basic authentication functionality for testing parts of your engine
511
gem 'solidus_auth_devise', '~> 1.0'
612

7-
group :test do
8-
gem 'rails-controller-testing'
13+
group :development, :test do
14+
gem "pry-rails"
915
end
1016

1117
gemspec

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2016 [name of plugin creator]
1+
Copyright (c) 2016 Stembolt
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification,

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ Simply add this require statement to your spec_helper:
3636
require 'solidus_paypal_braintree/factories'
3737
```
3838

39-
Copyright (c) 2016 [name of extension creator], released under the New BSD License
39+
Copyright (c) 2016 Stembolt, released under the New BSD License

app/controllers/solidus_paypal_braintree/checkouts_controller.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ class SolidusPaypalBraintree::CheckoutsController < Spree::CheckoutController
1111
].freeze
1212

1313
def update
14-
@order.payments.create!(payment_params)
14+
@payment = Spree::PaymentCreate.new(@order, payment_params).build
1515

16-
render text: 'ok'
16+
if @payment.save
17+
render text: "ok"
18+
else
19+
render text: "not-ok"
20+
end
1721
end
1822

1923
def order_params

db/migrate/20160830061749_create_solidus_paypal_braintree_sources.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def change
66
t.integer :user_id, index: true
77
t.references :payment_method, foreign_key: { to_table: :spree_payment_method }, index: { name: 'index_braintree_source_payment_method' }
88

9-
t.timestamps
9+
t.timestamps null: false
1010
end
1111
end
1212
end

solidus_paypal_braintree.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
1717
s.test_files = Dir['test/**/*']
1818

1919
s.add_dependency "solidus", ['>= 1.0', '< 3']
20-
s.add_dependency "braintree", '~> 2.65'
20+
s.add_dependency "braintree", '~> 2.65'
2121

2222
s.add_development_dependency 'capybara'
2323
s.add_development_dependency 'poltergeist'
@@ -26,8 +26,8 @@ Gem::Specification.new do |s|
2626
s.add_development_dependency 'database_cleaner'
2727
s.add_development_dependency 'factory_girl'
2828
s.add_development_dependency 'rspec-rails'
29-
s.add_development_dependency 'rubocop', '0.37.2'
30-
s.add_development_dependency 'rubocop-rspec', '1.4.0'
29+
s.add_development_dependency 'rubocop'
30+
s.add_development_dependency 'rubocop-rspec'
3131
s.add_development_dependency 'simplecov'
3232
s.add_development_dependency 'sqlite3'
3333
s.add_development_dependency 'webmock'

spec/spec_helper.rb

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
Braintree::Configuration.public_key = 'mwjkkxwcp32ckhnf'
4242
Braintree::Configuration.private_key = 'a9298f43b30c699db3072cc4a00f7f49'
4343
Braintree::Configuration.merchant_id = '7rdg92j7bm7fk5h3'
44+
Braintree::Configuration.logger = Rails.logger
4445

4546
VCR.configure do |c|
4647
c.cassette_library_dir = "spec/fixtures/cassettes"
@@ -50,54 +51,29 @@
5051
end
5152

5253
RSpec.configure do |config|
53-
config.include FactoryGirl::Syntax::Methods
54-
55-
# Infer an example group's spec type from the file location.
5654
config.infer_spec_type_from_file_location!
57-
58-
# == URL Helpers
59-
#
60-
# Allows access to Spree's routes in specs:
61-
#
62-
# visit spree.admin_path
63-
# current_path.should eql(spree.products_path)
64-
config.include Spree::TestingSupport::UrlHelpers
65-
66-
# == Mock Framework
67-
#
68-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
69-
#
70-
# config.mock_with :mocha
71-
# config.mock_with :flexmock
72-
# config.mock_with :rr
7355
config.mock_with :rspec
74-
config.color = true
75-
76-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
77-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
7856

79-
# Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
80-
# to cleanup after each test instead. Without transactional fixtures set to false the records created
81-
# to setup a test will be unavailable to the browser, which runs under a separate server instance.
57+
config.filter_run focus: true
58+
config.run_all_when_everything_filtered = true
8259
config.use_transactional_fixtures = false
8360

84-
# Ensure Suite is set to use transactions for speed.
61+
config.fail_fast = ENV['FAIL_FAST'] || false
62+
63+
config.include FactoryGirl::Syntax::Methods
64+
config.include Spree::TestingSupport::UrlHelpers
65+
8566
config.before :suite do
8667
DatabaseCleaner.strategy = :transaction
8768
DatabaseCleaner.clean_with :truncation
8869
end
8970

90-
# Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
9171
config.before :each do
9272
DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction
9373
DatabaseCleaner.start
9474
end
9575

96-
# After each spec clean the database.
9776
config.after :each do
9877
DatabaseCleaner.clean
9978
end
100-
101-
config.fail_fast = ENV['FAIL_FAST'] || false
102-
config.order = 'random'
10379
end

0 commit comments

Comments
 (0)