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

Some minor clean-up #2

Merged
merged 9 commits into from
Sep 2, 2016
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
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ script:
- bundle exec rake
rvm:
- 2.1.5
env:
matrix:
- SOLIDUS_BRANCH=v1.1
- SOLIDUS_BRANCH=v1.2
- SOLIDUS_BRANCH=v1.3
- SOLIDUS_BRANCH=v1.4
- SOLIDUS_BRANCH=v2.0
- SOLIDUS_BRANCH=master
12 changes: 9 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
source 'https://rubygems.org'

gem 'solidus', github: 'solidusio/solidus'
branch = ENV.fetch("SOLIDUS_BRANCH", "master")
gem 'solidus', github: 'solidusio/solidus', branch: branch

if branch == "master" || branch >= "v2.0"
gem "rails-controller-testing", group: :test
end

# Provides basic authentication functionality for testing parts of your engine
gem 'solidus_auth_devise', '~> 1.0'

group :test do
gem 'rails-controller-testing'
group :development, :test do
gem "pry-rails"
end

gemspec
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2016 [name of plugin creator]
Copyright (c) 2016 Stembolt
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ Simply add this require statement to your spec_helper:
require 'solidus_paypal_braintree/factories'
```

Copyright (c) 2016 [name of extension creator], released under the New BSD License
Copyright (c) 2016 Stembolt, released under the New BSD License
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ class SolidusPaypalBraintree::CheckoutsController < Spree::CheckoutController
].freeze

def update
@order.payments.create!(payment_params)
@payment = Spree::PaymentCreate.new(@order, payment_params).build

render text: 'ok'
if @payment.save
render text: "ok"
else
render text: "not-ok"
end
end

def order_params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def change
t.integer :user_id, index: true
t.references :payment_method, foreign_key: { to_table: :spree_payment_method }, index: { name: 'index_braintree_source_payment_method' }

t.timestamps
t.timestamps null: false
end
end
end
6 changes: 3 additions & 3 deletions solidus_paypal_braintree.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.test_files = Dir['test/**/*']

s.add_dependency "solidus", ['>= 1.0', '< 3']
s.add_dependency "braintree", '~> 2.65'
s.add_dependency "braintree", '~> 2.65'

s.add_development_dependency 'capybara'
s.add_development_dependency 'poltergeist'
Expand All @@ -26,8 +26,8 @@ Gem::Specification.new do |s|
s.add_development_dependency 'database_cleaner'
s.add_development_dependency 'factory_girl'
s.add_development_dependency 'rspec-rails'
s.add_development_dependency 'rubocop', '0.37.2'
s.add_development_dependency 'rubocop-rspec', '1.4.0'
s.add_development_dependency 'rubocop'
s.add_development_dependency 'rubocop-rspec'
s.add_development_dependency 'simplecov'
s.add_development_dependency 'sqlite3'
s.add_development_dependency 'webmock'
Expand Down
40 changes: 8 additions & 32 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
Braintree::Configuration.public_key = 'mwjkkxwcp32ckhnf'
Braintree::Configuration.private_key = 'a9298f43b30c699db3072cc4a00f7f49'
Braintree::Configuration.merchant_id = '7rdg92j7bm7fk5h3'
Braintree::Configuration.logger = Rails.logger

VCR.configure do |c|
c.cassette_library_dir = "spec/fixtures/cassettes"
Expand All @@ -50,54 +51,29 @@
end

RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods

# Infer an example group's spec type from the file location.
config.infer_spec_type_from_file_location!

# == URL Helpers
#
# Allows access to Spree's routes in specs:
#
# visit spree.admin_path
# current_path.should eql(spree.products_path)
config.include Spree::TestingSupport::UrlHelpers

# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.mock_with :rspec
config.color = true

# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"

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

# Ensure Suite is set to use transactions for speed.
config.fail_fast = ENV['FAIL_FAST'] || false

config.include FactoryGirl::Syntax::Methods
config.include Spree::TestingSupport::UrlHelpers

config.before :suite do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with :truncation
end

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

# After each spec clean the database.
config.after :each do
DatabaseCleaner.clean
end

config.fail_fast = ENV['FAIL_FAST'] || false
config.order = 'random'
end