solidus_support 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gem_release.yml +5 -0
- data/.github/stale.yml +17 -0
- data/.gitignore +17 -12
- data/.rspec +1 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +89 -0
- data/Gemfile +5 -9
- data/LICENSE +26 -0
- data/README.md +19 -17
- data/bin/console +17 -0
- data/bin/setup +7 -0
- data/lib/solidus_support/engine_extensions/decorators.rb +2 -2
- data/lib/solidus_support/version.rb +1 -1
- data/solidus_support.gemspec +23 -19
- data/spec/solidus_support_spec.rb +45 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/dummy_app.rb +21 -0
- data/spec/support/dummy_app/database.yml +16 -0
- metadata +21 -12
- data/.travis.yml +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ceefe11ac7e48cfcba96aec57eff516d8d517c48f990098645d380f5c33ad6b9
|
|
4
|
+
data.tar.gz: 1ce25f4ff870f87f137ba021ee8db5db76bb6031ffb22e18f49cea21be3ac882
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b9b82cf9add77927ae9a2b2b087c886dae93d4577a9daf58274464b07ab5fa6e89725ec32a558f1dd79f75b507ff908287a8b9af9ec5b146611fd270a900446
|
|
7
|
+
data.tar.gz: 7e37c959b0790f36cdb89af526bf56b364b30356ed88c2888bce34c6b4984fc53631dec1c6acde601e64e0ba80a39a8dde84665cd64f7c30fa679542e4e87131
|
data/.gem_release.yml
ADDED
data/.github/stale.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Number of days of inactivity before an issue becomes stale
|
|
2
|
+
daysUntilStale: 60
|
|
3
|
+
# Number of days of inactivity before a stale issue is closed
|
|
4
|
+
daysUntilClose: 7
|
|
5
|
+
# Issues with these labels will never be considered stale
|
|
6
|
+
exemptLabels:
|
|
7
|
+
- pinned
|
|
8
|
+
- security
|
|
9
|
+
# Label to use when marking an issue as stale
|
|
10
|
+
staleLabel: wontfix
|
|
11
|
+
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
12
|
+
markComment: >
|
|
13
|
+
This issue has been automatically marked as stale because it has not had
|
|
14
|
+
recent activity. It will be closed if no further activity occurs. Thank you
|
|
15
|
+
for your contributions.
|
|
16
|
+
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
17
|
+
closeComment: false
|
data/.gitignore
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
*.gem
|
|
2
|
+
\#*
|
|
3
|
+
*~
|
|
4
|
+
.#*
|
|
5
|
+
.DS_Store
|
|
6
|
+
.idea
|
|
7
|
+
.project
|
|
8
|
+
.sass-cache
|
|
9
|
+
coverage
|
|
10
|
+
Gemfile.lock
|
|
11
|
+
tmp
|
|
12
|
+
nbproject
|
|
13
|
+
pkg
|
|
14
|
+
*.swp
|
|
15
|
+
spec/dummy
|
|
16
|
+
spec/examples.txt
|
|
17
|
+
log
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
require:
|
|
2
|
-
-
|
|
2
|
+
- solidus_dev_support/rubocop
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [v0.4.0](https://github.com/solidusio/solidus_support/tree/v0.4.0) (2019-12-16)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.3.2...v0.4.0)
|
|
6
|
+
|
|
7
|
+
**Closed issues:**
|
|
8
|
+
|
|
9
|
+
- Configure CircleCI [\#30](https://github.com/solidusio/solidus_support/issues/30)
|
|
10
|
+
- Models::SolidusGlobalize::Spree::TaxonomyDecorator \(NameError\) [\#26](https://github.com/solidusio/solidus_support/issues/26)
|
|
11
|
+
|
|
12
|
+
**Merged pull requests:**
|
|
13
|
+
|
|
14
|
+
- Fix issues with test runs [\#32](https://github.com/solidusio/solidus_support/pull/32) ([aldesantis](https://github.com/aldesantis))
|
|
15
|
+
- Add CircleCI configuration [\#31](https://github.com/solidusio/solidus_support/pull/31) ([aldesantis](https://github.com/aldesantis))
|
|
16
|
+
- Introduce solidus\_extension\_dev\_tools [\#29](https://github.com/solidusio/solidus_support/pull/29) ([aldesantis](https://github.com/aldesantis))
|
|
17
|
+
- Remove support for testing and extensions [\#28](https://github.com/solidusio/solidus_support/pull/28) ([MinasMazar](https://github.com/MinasMazar))
|
|
18
|
+
- Add SolidusSupport::EngineExtension::Decorators to load decorators [\#27](https://github.com/solidusio/solidus_support/pull/27) ([kennyadsl](https://github.com/kennyadsl))
|
|
19
|
+
- Add support for Codecov [\#24](https://github.com/solidusio/solidus_support/pull/24) ([aldesantis](https://github.com/aldesantis))
|
|
20
|
+
|
|
21
|
+
## [v0.3.2](https://github.com/solidusio/solidus_support/tree/v0.3.2) (2019-08-08)
|
|
22
|
+
|
|
23
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.2.1...v0.3.2)
|
|
24
|
+
|
|
25
|
+
**Merged pull requests:**
|
|
26
|
+
|
|
27
|
+
- Add `capybara-screenshot` dependency [\#23](https://github.com/solidusio/solidus_support/pull/23) ([spaghetticode](https://github.com/spaghetticode))
|
|
28
|
+
- Do not reset spree preferences starting from v2.9 [\#22](https://github.com/solidusio/solidus_support/pull/22) ([kennyadsl](https://github.com/kennyadsl))
|
|
29
|
+
- Update Travis config [\#19](https://github.com/solidusio/solidus_support/pull/19) ([aitbw](https://github.com/aitbw))
|
|
30
|
+
- Override Capybara JS driver via `CAPYBARA\_DRIVER` ENV variable [\#18](https://github.com/solidusio/solidus_support/pull/18) ([spaghetticode](https://github.com/spaghetticode))
|
|
31
|
+
- Migrate from Poltergeist to Headless Chrome [\#16](https://github.com/solidusio/solidus_support/pull/16) ([aitbw](https://github.com/aitbw))
|
|
32
|
+
- Remove running rubocop on rake task [\#14](https://github.com/solidusio/solidus_support/pull/14) ([kennyadsl](https://github.com/kennyadsl))
|
|
33
|
+
- Cleanup extension [\#13](https://github.com/solidusio/solidus_support/pull/13) ([kennyadsl](https://github.com/kennyadsl))
|
|
34
|
+
- Fix how we compare gem versions to determine new gateway code usage [\#12](https://github.com/solidusio/solidus_support/pull/12) ([kennyadsl](https://github.com/kennyadsl))
|
|
35
|
+
- Add payment method parent class [\#8](https://github.com/solidusio/solidus_support/pull/8) ([tvdeyen](https://github.com/tvdeyen))
|
|
36
|
+
- Improve gem documentation [\#7](https://github.com/solidusio/solidus_support/pull/7) ([kennyadsl](https://github.com/kennyadsl))
|
|
37
|
+
|
|
38
|
+
## [v0.2.1](https://github.com/solidusio/solidus_support/tree/v0.2.1) (2018-02-22)
|
|
39
|
+
|
|
40
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.2.0...v0.2.1)
|
|
41
|
+
|
|
42
|
+
**Merged pull requests:**
|
|
43
|
+
|
|
44
|
+
- Ensure database cleaning is very last in each spec [\#9](https://github.com/solidusio/solidus_support/pull/9) ([jhawthorn](https://github.com/jhawthorn))
|
|
45
|
+
|
|
46
|
+
## [v0.2.0](https://github.com/solidusio/solidus_support/tree/v0.2.0) (2017-10-25)
|
|
47
|
+
|
|
48
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.5...v0.2.0)
|
|
49
|
+
|
|
50
|
+
**Merged pull requests:**
|
|
51
|
+
|
|
52
|
+
- Rename FactoryBot [\#6](https://github.com/solidusio/solidus_support/pull/6) ([tvdeyen](https://github.com/tvdeyen))
|
|
53
|
+
- Remove unused files [\#5](https://github.com/solidusio/solidus_support/pull/5) ([tvdeyen](https://github.com/tvdeyen))
|
|
54
|
+
|
|
55
|
+
## [v0.1.5](https://github.com/solidusio/solidus_support/tree/v0.1.5) (2017-07-27)
|
|
56
|
+
|
|
57
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.4...v0.1.5)
|
|
58
|
+
|
|
59
|
+
## [v0.1.4](https://github.com/solidusio/solidus_support/tree/v0.1.4) (2017-07-26)
|
|
60
|
+
|
|
61
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.3...v0.1.4)
|
|
62
|
+
|
|
63
|
+
## [v0.1.3](https://github.com/solidusio/solidus_support/tree/v0.1.3) (2017-07-26)
|
|
64
|
+
|
|
65
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.2...v0.1.3)
|
|
66
|
+
|
|
67
|
+
**Merged pull requests:**
|
|
68
|
+
|
|
69
|
+
- Add a basic spec\_helper for extensions to include [\#2](https://github.com/solidusio/solidus_support/pull/2) ([jhawthorn](https://github.com/jhawthorn))
|
|
70
|
+
|
|
71
|
+
## [v0.1.2](https://github.com/solidusio/solidus_support/tree/v0.1.2) (2017-07-24)
|
|
72
|
+
|
|
73
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.1...v0.1.2)
|
|
74
|
+
|
|
75
|
+
**Merged pull requests:**
|
|
76
|
+
|
|
77
|
+
- Add SolidusSupport.payment\_source\_parent\_class [\#1](https://github.com/solidusio/solidus_support/pull/1) ([jordan-brough](https://github.com/jordan-brough))
|
|
78
|
+
|
|
79
|
+
## [v0.1.1](https://github.com/solidusio/solidus_support/tree/v0.1.1) (2017-05-03)
|
|
80
|
+
|
|
81
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.0...v0.1.1)
|
|
82
|
+
|
|
83
|
+
## [v0.1.0](https://github.com/solidusio/solidus_support/tree/v0.1.0) (2017-03-21)
|
|
84
|
+
|
|
85
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/b34d603b2b603e8799ce801913b577322bd39bdc...v0.1.0)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
source 'https://rubygems.org'
|
|
4
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
4
5
|
|
|
5
6
|
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
|
6
7
|
gem 'solidus_core', github: 'solidusio/solidus', branch: branch
|
|
7
8
|
|
|
8
|
-
# Specify your gem's dependencies in solidus_support.gemspec
|
|
9
|
-
gemspec
|
|
10
|
-
|
|
11
|
-
gem 'solidus_extension_dev_tools', github: 'solidusio-contrib/solidus_extension_dev_tools'
|
|
12
|
-
gem 'sprockets', '~> 3'
|
|
13
|
-
gem 'sprockets-rails'
|
|
14
|
-
|
|
15
9
|
case ENV['DB']
|
|
16
|
-
when 'postgresql'
|
|
17
|
-
gem 'pg'
|
|
18
10
|
when 'mysql'
|
|
19
11
|
gem 'mysql2'
|
|
12
|
+
when 'postgresql'
|
|
13
|
+
gem 'pg'
|
|
20
14
|
else
|
|
21
15
|
gem 'sqlite3'
|
|
22
16
|
end
|
|
17
|
+
|
|
18
|
+
gemspec
|
data/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Copyright (c) 2017 Solidus
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
5
|
+
are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
|
11
|
+
and/or other materials provided with the distribution.
|
|
12
|
+
* Neither the name Solidus nor the names of its contributors may be used to
|
|
13
|
+
endorse or promote products derived from this software without specific
|
|
14
|
+
prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
17
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
18
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
19
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
20
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
21
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
22
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
23
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
24
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
25
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
26
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# SolidusSupport
|
|
2
2
|
|
|
3
|
-
This gem
|
|
3
|
+
This gem contains common runtime functionality for Solidus extensions.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
If you are looking for development tools instead, see
|
|
6
|
+
[solidus_dev_support](https://github.com/solidusio-contrib/solidus_dev_support).
|
|
6
7
|
|
|
7
8
|
## Usage
|
|
8
9
|
|
|
9
10
|
### `SolidusSupport::Migration`
|
|
10
11
|
|
|
11
|
-
Rails >= 5 introduced the concept of specifying what
|
|
12
|
-
Not specifying a version is deprecated in Rails 5.0 and removed
|
|
13
|
-
This wasn't backported to Rails 4.2,
|
|
12
|
+
Rails >= 5 introduced the concept of specifying what Rails version your migration was written for,
|
|
13
|
+
like `ActiveRecord::Migration[5.0]`. Not specifying a version is deprecated in Rails 5.0 and removed
|
|
14
|
+
in Rails 5.1. This wasn't backported to Rails 4.2, so we provide this helper to return the right
|
|
15
|
+
parent class:
|
|
14
16
|
|
|
15
17
|
``` ruby
|
|
16
18
|
# On Rails 4.2
|
|
@@ -22,15 +24,14 @@ SolidusSupport::Migration[4.2] # same as `ActiveRecord::Migration[4.2]`
|
|
|
22
24
|
SolidusSupport::Migration[5.0] # same as `ActiveRecord::Migration[5.0]`
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
There's no reason to use `SolidusSupport::Migration[5.0]` over `ActiveRecord::Migration[5.0]`, but
|
|
27
|
+
There's no reason to use `SolidusSupport::Migration[5.0]` over `ActiveRecord::Migration[5.0]`, but
|
|
28
|
+
it is provided.
|
|
26
29
|
|
|
27
|
-
### Engine
|
|
30
|
+
### Engine extensions
|
|
28
31
|
|
|
29
|
-
This extension provides a module that
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
To use it just include the provided module in the Engine as follow:
|
|
32
|
+
This extension provides a module that decorates `Rails::Engine` to seamlessly support autoloading
|
|
33
|
+
decorators both with the classic autoloader and with Zeitwerk on Rails 6. In order to use it, just
|
|
34
|
+
include the provided module in your `Engine` class:
|
|
34
35
|
|
|
35
36
|
```ruby
|
|
36
37
|
module SolidusExtensionName
|
|
@@ -38,13 +39,13 @@ module SolidusExtensionName
|
|
|
38
39
|
engine_name 'solidus_extension_name'
|
|
39
40
|
|
|
40
41
|
include SolidusSupport::EngineExtensions::Decorators
|
|
42
|
+
|
|
41
43
|
# ...
|
|
42
44
|
end
|
|
43
45
|
end
|
|
44
46
|
```
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
Engine, that should be something like:
|
|
48
|
+
If needed, also ensure to remove the original implementation of `.activate`:
|
|
48
49
|
|
|
49
50
|
```ruby
|
|
50
51
|
def self.activate
|
|
@@ -58,9 +59,10 @@ config.to_prepare(&method(:activate).to_proc)
|
|
|
58
59
|
|
|
59
60
|
## Development
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new
|
|
63
|
+
version, update the version number in `version.rb`, and then run `bundle exec rake release`, which
|
|
64
|
+
will create a git tag for the version, push git commits and tags, and push the `.gem` file to
|
|
65
|
+
[rubygems.org](https://rubygems.org).
|
|
64
66
|
|
|
65
67
|
## Contributing
|
|
66
68
|
|
data/bin/console
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
require "bundler/setup"
|
|
6
|
+
require "solidus_support"
|
|
7
|
+
|
|
8
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
9
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
10
|
+
$LOAD_PATH.unshift(*Dir["#{__dir__}/../app/*"])
|
|
11
|
+
|
|
12
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
13
|
+
# require "pry"
|
|
14
|
+
# Pry.start
|
|
15
|
+
|
|
16
|
+
require "irb"
|
|
17
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -14,7 +14,7 @@ module SolidusSupport
|
|
|
14
14
|
def activate
|
|
15
15
|
base_path = root.join('app/decorators')
|
|
16
16
|
|
|
17
|
-
if Rails.respond_to?(:autoloaders)
|
|
17
|
+
if Rails.respond_to?(:autoloaders) && Rails.autoloaders.main
|
|
18
18
|
# Add decorators folder to the Rails autoloader. This
|
|
19
19
|
# allows Zeitwerk to resolve decorators paths correctly,
|
|
20
20
|
# when used.
|
|
@@ -28,7 +28,7 @@ module SolidusSupport
|
|
|
28
28
|
# and won't be loaded by default. We need them to be
|
|
29
29
|
# executed anyway to extend exisiting classes.
|
|
30
30
|
Dir.glob(base_path.join('**/*.rb')) do |decorator_path|
|
|
31
|
-
|
|
31
|
+
require_dependency(decorator_path)
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
data/solidus_support.gemspec
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
$:.push File.expand_path('lib', __dir__)
|
|
5
4
|
require 'solidus_support/version'
|
|
6
5
|
|
|
7
|
-
Gem::Specification.new do |
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = 'solidus_support'
|
|
8
|
+
s.version = SolidusSupport::VERSION
|
|
9
|
+
s.summary = 'Common runtime helpers for Solidus extensions.'
|
|
10
|
+
s.license = 'BSD-3-Clause'
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
s.author = 'John Hawthorn'
|
|
13
|
+
s.email = 'john@stembolt.com'
|
|
14
|
+
s.homepage = 'https://github.com/solidusio/solidus_support'
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
s.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
18
|
+
end
|
|
19
|
+
s.test_files = Dir['spec/**/*']
|
|
20
|
+
s.bindir = "exe"
|
|
21
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
|
+
s.require_paths = ["lib"]
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
s.add_development_dependency 'bundler'
|
|
25
|
+
s.add_development_dependency 'rake'
|
|
26
|
+
s.add_development_dependency 'rspec-rails'
|
|
27
|
+
s.add_development_dependency 'rubocop'
|
|
28
|
+
s.add_development_dependency 'rubocop-rspec'
|
|
29
|
+
s.add_development_dependency 'solidus_core'
|
|
30
|
+
s.add_development_dependency 'solidus_dev_support'
|
|
27
31
|
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
RSpec.describe SolidusSupport do
|
|
4
|
+
describe '.payment_method_parent_class' do
|
|
5
|
+
subject { described_class.payment_method_parent_class(credit_card: credit_card) }
|
|
6
|
+
|
|
7
|
+
let(:credit_card) { nil }
|
|
8
|
+
|
|
9
|
+
before do
|
|
10
|
+
allow(described_class).to receive(:solidus_gem_version) do
|
|
11
|
+
Gem::Version.new(solidus_version)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
context 'with Solidus < 2.3' do
|
|
16
|
+
let(:solidus_version) { '2.2.1' }
|
|
17
|
+
|
|
18
|
+
it { is_expected.to eq(Spree::Gateway) }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
context 'with Solidus >= 2.3' do
|
|
22
|
+
let(:solidus_version) { '2.3.1' }
|
|
23
|
+
|
|
24
|
+
it { is_expected.to eq(Spree::PaymentMethod) }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# rubocop:disable RSpec/NestedGroups
|
|
28
|
+
context 'with credit_card: true' do
|
|
29
|
+
let(:credit_card) { true }
|
|
30
|
+
|
|
31
|
+
context 'with Solidus < 2.3' do
|
|
32
|
+
let(:solidus_version) { '2.2.1' }
|
|
33
|
+
|
|
34
|
+
it { is_expected.to eq(Spree::Gateway) }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
context 'with Solidus >= 2.3' do
|
|
38
|
+
let(:solidus_version) { '2.3.1' }
|
|
39
|
+
|
|
40
|
+
it { is_expected.to eq(Spree::PaymentMethod::CreditCard) }
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
# rubocop:enable RSpec/NestedGroups
|
|
44
|
+
end
|
|
45
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Configure Rails Environment
|
|
4
|
+
ENV['RAILS_ENV'] = 'test'
|
|
5
|
+
|
|
6
|
+
# Run Coverage report
|
|
7
|
+
require 'solidus_dev_support/rspec/coverage'
|
|
8
|
+
|
|
9
|
+
# Load dummy app
|
|
10
|
+
require_relative 'support/dummy_app'
|
|
11
|
+
|
|
12
|
+
# Requires factories and other useful helpers defined in spree_core.
|
|
13
|
+
require 'solidus_dev_support/rspec/spec_helper'
|
|
14
|
+
|
|
15
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
16
|
+
# in spec/support/ and its subdirectories.
|
|
17
|
+
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
ENV['RAILS_ENV'] = 'test'
|
|
4
|
+
ENV['DISABLE_DATABASE_ENVIRONMENT_CHECK'] = '1'
|
|
5
|
+
|
|
6
|
+
Bundler.setup
|
|
7
|
+
|
|
8
|
+
require 'rails'
|
|
9
|
+
require 'solidus_core'
|
|
10
|
+
|
|
11
|
+
Bundler.require(:default, :test)
|
|
12
|
+
|
|
13
|
+
module DummyApp
|
|
14
|
+
class Application < ::Rails::Application
|
|
15
|
+
config.eager_load = false
|
|
16
|
+
config.paths['config/database'] = File.expand_path('dummy_app/database.yml', __dir__)
|
|
17
|
+
config.active_record.sqlite3.represent_boolean_as_integer = true
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
DummyApp::Application.initialize!
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<% if ENV['DB'] == 'postgresql' %>
|
|
2
|
+
test:
|
|
3
|
+
adapter: postgresql
|
|
4
|
+
database: circle_test
|
|
5
|
+
username: root
|
|
6
|
+
<% elsif ENV['DB'] == 'mysql' %>
|
|
7
|
+
test:
|
|
8
|
+
adapter: mysql2
|
|
9
|
+
database: circle_test
|
|
10
|
+
username: root
|
|
11
|
+
<% else %>
|
|
12
|
+
test:
|
|
13
|
+
adapter: sqlite3
|
|
14
|
+
database: ':memory:'
|
|
15
|
+
timeout: 10000
|
|
16
|
+
<% end %>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_support
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Hawthorn
|
|
8
8
|
autorequire:
|
|
9
|
-
bindir:
|
|
9
|
+
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-01-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -95,7 +95,7 @@ dependencies:
|
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
98
|
+
name: solidus_dev_support
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
101
|
- - ">="
|
|
@@ -108,21 +108,25 @@ dependencies:
|
|
|
108
108
|
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
|
-
description:
|
|
112
|
-
email:
|
|
113
|
-
- john@stembolt.com
|
|
111
|
+
description:
|
|
112
|
+
email: john@stembolt.com
|
|
114
113
|
executables: []
|
|
115
114
|
extensions: []
|
|
116
115
|
extra_rdoc_files: []
|
|
117
116
|
files:
|
|
118
117
|
- ".circleci/config.yml"
|
|
118
|
+
- ".gem_release.yml"
|
|
119
|
+
- ".github/stale.yml"
|
|
119
120
|
- ".gitignore"
|
|
120
121
|
- ".rspec"
|
|
121
122
|
- ".rubocop.yml"
|
|
122
|
-
-
|
|
123
|
+
- CHANGELOG.md
|
|
123
124
|
- Gemfile
|
|
125
|
+
- LICENSE
|
|
124
126
|
- README.md
|
|
125
127
|
- Rakefile
|
|
128
|
+
- bin/console
|
|
129
|
+
- bin/setup
|
|
126
130
|
- lib/solidus_support.rb
|
|
127
131
|
- lib/solidus_support/engine_extensions.rb
|
|
128
132
|
- lib/solidus_support/engine_extensions/decorators.rb
|
|
@@ -133,8 +137,9 @@ files:
|
|
|
133
137
|
- spec/spec_helper.rb
|
|
134
138
|
- spec/support/dummy_app.rb
|
|
135
139
|
- spec/support/dummy_app/database.yml
|
|
136
|
-
homepage: https://
|
|
137
|
-
licenses:
|
|
140
|
+
homepage: https://github.com/solidusio/solidus_support
|
|
141
|
+
licenses:
|
|
142
|
+
- BSD-3-Clause
|
|
138
143
|
metadata: {}
|
|
139
144
|
post_install_message:
|
|
140
145
|
rdoc_options: []
|
|
@@ -154,5 +159,9 @@ requirements: []
|
|
|
154
159
|
rubygems_version: 3.0.6
|
|
155
160
|
signing_key:
|
|
156
161
|
specification_version: 4
|
|
157
|
-
summary:
|
|
158
|
-
test_files:
|
|
162
|
+
summary: Common runtime helpers for Solidus extensions.
|
|
163
|
+
test_files:
|
|
164
|
+
- spec/spec_helper.rb
|
|
165
|
+
- spec/solidus_support_spec.rb
|
|
166
|
+
- spec/support/dummy_app.rb
|
|
167
|
+
- spec/support/dummy_app/database.yml
|
data/.travis.yml
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
sudo: false
|
|
2
|
-
language: ruby
|
|
3
|
-
dist: trusty
|
|
4
|
-
cache:
|
|
5
|
-
bundler: true
|
|
6
|
-
before_install:
|
|
7
|
-
- "gem install bundler --pre"
|
|
8
|
-
- "bundler -v"
|
|
9
|
-
rvm:
|
|
10
|
-
- 2.4.2
|
|
11
|
-
env:
|
|
12
|
-
matrix:
|
|
13
|
-
- SOLIDUS_BRANCH=v2.4
|
|
14
|
-
- SOLIDUS_BRANCH=v2.5
|
|
15
|
-
- SOLIDUS_BRANCH=v2.6
|
|
16
|
-
- SOLIDUS_BRANCH=v2.7
|
|
17
|
-
- SOLIDUS_BRANCH=v2.8
|
|
18
|
-
- SOLIDUS_BRANCH=master
|