solidus_support 0.3.3 → 0.6.0
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/.circleci/config.yml +35 -0
- data/.gem_release.yml +5 -0
- data/.github/stale.yml +17 -0
- data/.gitignore +17 -10
- data/.rspec +1 -0
- data/.rubocop.yml +2 -8
- data/CHANGELOG.md +114 -0
- data/Gemfile +12 -4
- data/LICENSE +26 -0
- data/README.md +46 -48
- data/Rakefile +2 -0
- data/bin/console +17 -0
- data/bin/setup +7 -0
- data/lib/solidus_support.rb +11 -11
- data/lib/solidus_support/engine_extensions.rb +96 -0
- data/lib/solidus_support/migration.rb +2 -0
- data/lib/solidus_support/version.rb +3 -1
- data/solidus_support.gemspec +24 -20
- data/spec/solidus_support_spec.rb +9 -5
- data/spec/spec_helper.rb +16 -1
- data/spec/support/dummy_app.rb +2 -0
- data/spec/support/dummy_app/database.yml +12 -0
- metadata +55 -43
- data/.travis.yml +0 -18
- data/lib/solidus_support/extension/coverage.rb +0 -16
- data/lib/solidus_support/extension/feature_helper.rb +0 -44
- data/lib/solidus_support/extension/rails_helper.rb +0 -45
- data/lib/solidus_support/extension/spec_helper.rb +0 -19
- data/lib/solidus_support/testing_support/preferences.rb +0 -45
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52891f7c46410b049481d932d3936da5530d1eabd601d0af44760398b4560200
|
|
4
|
+
data.tar.gz: 47b62f091de89edaf01b1e57ce6b1fdf10c558f801ead911822b88bbd8baffa7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2e55cb09d122d874ae9548420477d71a001fa7835f0027c976fca6cfef89351f0546b9477a5d219b9c80c15858e46edf510763b97301adf633dcaa97512d7237
|
|
7
|
+
data.tar.gz: 965ee76ae136fe8fc11987327044994b4fb1162a9f5516b1c50a47103ecc068acbf8cdc5ba5af68cb1b6e11bf41eb3c10bb50b0291f249dcee0c45341e0cfcd4
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
|
|
3
|
+
orbs:
|
|
4
|
+
# Always take the latest version of the orb, this allows us to
|
|
5
|
+
# run specs against Solidus supported versions only without the need
|
|
6
|
+
# to change this configuration every time a Solidus version is released
|
|
7
|
+
# or goes EOL.
|
|
8
|
+
solidusio_extensions: solidusio/extensions@volatile
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
run-specs-with-postgres:
|
|
12
|
+
executor: solidusio_extensions/postgres
|
|
13
|
+
steps:
|
|
14
|
+
- solidusio_extensions/run-tests
|
|
15
|
+
run-specs-with-mysql:
|
|
16
|
+
executor: solidusio_extensions/mysql
|
|
17
|
+
steps:
|
|
18
|
+
- solidusio_extensions/run-tests
|
|
19
|
+
|
|
20
|
+
workflows:
|
|
21
|
+
"Run specs on supported Solidus versions":
|
|
22
|
+
jobs:
|
|
23
|
+
- run-specs-with-postgres
|
|
24
|
+
- run-specs-with-mysql
|
|
25
|
+
"Weekly run specs against master":
|
|
26
|
+
triggers:
|
|
27
|
+
- schedule:
|
|
28
|
+
cron: "0 0 * * 4" # every Thursday
|
|
29
|
+
filters:
|
|
30
|
+
branches:
|
|
31
|
+
only:
|
|
32
|
+
- master
|
|
33
|
+
jobs:
|
|
34
|
+
- run-specs-with-postgres
|
|
35
|
+
- run-specs-with-mysql
|
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,10 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [v0.5.0](https://github.com/solidusio/solidus_support/tree/v0.5.0) (2020-02-18)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.4.1...v0.5.0)
|
|
6
|
+
|
|
7
|
+
**Merged pull requests:**
|
|
8
|
+
|
|
9
|
+
- Load Solidus engine extension files automatically [\#42](https://github.com/solidusio/solidus_support/pull/42) ([aldesantis](https://github.com/aldesantis))
|
|
10
|
+
- Deprecate SolidusSupport.solidus\_gem\_version [\#37](https://github.com/solidusio/solidus_support/pull/37) ([kennyadsl](https://github.com/kennyadsl))
|
|
11
|
+
|
|
12
|
+
## [v0.4.1](https://github.com/solidusio/solidus_support/tree/v0.4.1) (2020-01-16)
|
|
13
|
+
|
|
14
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.4.0...v0.4.1)
|
|
15
|
+
|
|
16
|
+
**Closed issues:**
|
|
17
|
+
|
|
18
|
+
- Should use require\_dependency instead of require/load [\#34](https://github.com/solidusio/solidus_support/issues/34)
|
|
19
|
+
- Add a LICENSE [\#20](https://github.com/solidusio/solidus_support/issues/20)
|
|
20
|
+
|
|
21
|
+
**Merged pull requests:**
|
|
22
|
+
|
|
23
|
+
- Update solidus\_dev\_support [\#41](https://github.com/solidusio/solidus_support/pull/41) ([aldesantis](https://github.com/aldesantis))
|
|
24
|
+
- Replace manual cache checks w/ require\_dependency [\#39](https://github.com/solidusio/solidus_support/pull/39) ([elia](https://github.com/elia))
|
|
25
|
+
- Fixes isse when zeitwerk is not enabled [\#38](https://github.com/solidusio/solidus_support/pull/38) ([softr8](https://github.com/softr8))
|
|
26
|
+
- Spring cleaning [\#33](https://github.com/solidusio/solidus_support/pull/33) ([aldesantis](https://github.com/aldesantis))
|
|
27
|
+
|
|
28
|
+
## [v0.4.0](https://github.com/solidusio/solidus_support/tree/v0.4.0) (2019-12-16)
|
|
29
|
+
|
|
30
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.3.2...v0.4.0)
|
|
31
|
+
|
|
32
|
+
**Closed issues:**
|
|
33
|
+
|
|
34
|
+
- Configure CircleCI [\#30](https://github.com/solidusio/solidus_support/issues/30)
|
|
35
|
+
- Models::SolidusGlobalize::Spree::TaxonomyDecorator \(NameError\) [\#26](https://github.com/solidusio/solidus_support/issues/26)
|
|
36
|
+
|
|
37
|
+
**Merged pull requests:**
|
|
38
|
+
|
|
39
|
+
- Fix issues with test runs [\#32](https://github.com/solidusio/solidus_support/pull/32) ([aldesantis](https://github.com/aldesantis))
|
|
40
|
+
- Add CircleCI configuration [\#31](https://github.com/solidusio/solidus_support/pull/31) ([aldesantis](https://github.com/aldesantis))
|
|
41
|
+
- Introduce solidus\_extension\_dev\_tools [\#29](https://github.com/solidusio/solidus_support/pull/29) ([aldesantis](https://github.com/aldesantis))
|
|
42
|
+
- Remove support for testing and extensions [\#28](https://github.com/solidusio/solidus_support/pull/28) ([MinasMazar](https://github.com/MinasMazar))
|
|
43
|
+
- Add SolidusSupport::EngineExtension::Decorators to load decorators [\#27](https://github.com/solidusio/solidus_support/pull/27) ([kennyadsl](https://github.com/kennyadsl))
|
|
44
|
+
- Add support for Codecov [\#24](https://github.com/solidusio/solidus_support/pull/24) ([aldesantis](https://github.com/aldesantis))
|
|
45
|
+
- Add `capybara-screenshot` dependency [\#23](https://github.com/solidusio/solidus_support/pull/23) ([spaghetticode](https://github.com/spaghetticode))
|
|
46
|
+
|
|
47
|
+
## [v0.3.2](https://github.com/solidusio/solidus_support/tree/v0.3.2) (2019-08-08)
|
|
48
|
+
|
|
49
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.2.1...v0.3.2)
|
|
50
|
+
|
|
51
|
+
**Merged pull requests:**
|
|
52
|
+
|
|
53
|
+
- Do not reset spree preferences starting from v2.9 [\#22](https://github.com/solidusio/solidus_support/pull/22) ([kennyadsl](https://github.com/kennyadsl))
|
|
54
|
+
- Update Travis config [\#19](https://github.com/solidusio/solidus_support/pull/19) ([aitbw](https://github.com/aitbw))
|
|
55
|
+
- Override Capybara JS driver via `CAPYBARA\_DRIVER` ENV variable [\#18](https://github.com/solidusio/solidus_support/pull/18) ([spaghetticode](https://github.com/spaghetticode))
|
|
56
|
+
- Migrate from Poltergeist to Headless Chrome [\#16](https://github.com/solidusio/solidus_support/pull/16) ([aitbw](https://github.com/aitbw))
|
|
57
|
+
- Remove running rubocop on rake task [\#14](https://github.com/solidusio/solidus_support/pull/14) ([kennyadsl](https://github.com/kennyadsl))
|
|
58
|
+
- Cleanup extension [\#13](https://github.com/solidusio/solidus_support/pull/13) ([kennyadsl](https://github.com/kennyadsl))
|
|
59
|
+
- 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))
|
|
60
|
+
- Add payment method parent class [\#8](https://github.com/solidusio/solidus_support/pull/8) ([tvdeyen](https://github.com/tvdeyen))
|
|
61
|
+
- Improve gem documentation [\#7](https://github.com/solidusio/solidus_support/pull/7) ([kennyadsl](https://github.com/kennyadsl))
|
|
62
|
+
|
|
63
|
+
## [v0.2.1](https://github.com/solidusio/solidus_support/tree/v0.2.1) (2018-02-22)
|
|
64
|
+
|
|
65
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.2.0...v0.2.1)
|
|
66
|
+
|
|
67
|
+
**Merged pull requests:**
|
|
68
|
+
|
|
69
|
+
- Ensure database cleaning is very last in each spec [\#9](https://github.com/solidusio/solidus_support/pull/9) ([jhawthorn](https://github.com/jhawthorn))
|
|
70
|
+
|
|
71
|
+
## [v0.2.0](https://github.com/solidusio/solidus_support/tree/v0.2.0) (2017-10-25)
|
|
72
|
+
|
|
73
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.5...v0.2.0)
|
|
74
|
+
|
|
75
|
+
**Merged pull requests:**
|
|
76
|
+
|
|
77
|
+
- Rename FactoryBot [\#6](https://github.com/solidusio/solidus_support/pull/6) ([tvdeyen](https://github.com/tvdeyen))
|
|
78
|
+
- Remove unused files [\#5](https://github.com/solidusio/solidus_support/pull/5) ([tvdeyen](https://github.com/tvdeyen))
|
|
79
|
+
|
|
80
|
+
## [v0.1.5](https://github.com/solidusio/solidus_support/tree/v0.1.5) (2017-07-27)
|
|
81
|
+
|
|
82
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.4...v0.1.5)
|
|
83
|
+
|
|
84
|
+
## [v0.1.4](https://github.com/solidusio/solidus_support/tree/v0.1.4) (2017-07-26)
|
|
85
|
+
|
|
86
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.3...v0.1.4)
|
|
87
|
+
|
|
88
|
+
## [v0.1.3](https://github.com/solidusio/solidus_support/tree/v0.1.3) (2017-07-26)
|
|
89
|
+
|
|
90
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.2...v0.1.3)
|
|
91
|
+
|
|
92
|
+
**Merged pull requests:**
|
|
93
|
+
|
|
94
|
+
- Add a basic spec\_helper for extensions to include [\#2](https://github.com/solidusio/solidus_support/pull/2) ([jhawthorn](https://github.com/jhawthorn))
|
|
95
|
+
|
|
96
|
+
## [v0.1.2](https://github.com/solidusio/solidus_support/tree/v0.1.2) (2017-07-24)
|
|
97
|
+
|
|
98
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.1...v0.1.2)
|
|
99
|
+
|
|
100
|
+
**Merged pull requests:**
|
|
101
|
+
|
|
102
|
+
- Add SolidusSupport.payment\_source\_parent\_class [\#1](https://github.com/solidusio/solidus_support/pull/1) ([jordan-brough](https://github.com/jordan-brough))
|
|
103
|
+
|
|
104
|
+
## [v0.1.1](https://github.com/solidusio/solidus_support/tree/v0.1.1) (2017-05-03)
|
|
105
|
+
|
|
106
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/v0.1.0...v0.1.1)
|
|
107
|
+
|
|
108
|
+
## [v0.1.0](https://github.com/solidusio/solidus_support/tree/v0.1.0) (2017-03-21)
|
|
109
|
+
|
|
110
|
+
[Full Changelog](https://github.com/solidusio/solidus_support/compare/b34d603b2b603e8799ce801913b577322bd39bdc...v0.1.0)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
source 'https://rubygems.org'
|
|
4
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
2
5
|
|
|
3
6
|
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
|
4
7
|
gem 'solidus_core', github: 'solidusio/solidus', branch: branch
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
case ENV['DB']
|
|
10
|
+
when 'mysql'
|
|
11
|
+
gem 'mysql2'
|
|
12
|
+
when 'postgresql'
|
|
13
|
+
gem 'pg'
|
|
14
|
+
else
|
|
15
|
+
gem 'sqlite3'
|
|
16
|
+
end
|
|
8
17
|
|
|
9
|
-
|
|
10
|
-
gem 'sqlite3'
|
|
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,69 +24,65 @@ 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
|
-
###
|
|
30
|
+
### Engine extensions
|
|
28
31
|
|
|
29
|
-
This
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Into your extension's spec/spec_helper.rb:
|
|
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:
|
|
33
35
|
|
|
34
36
|
```ruby
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
This helper loads configuration needed to run extensions feature specs
|
|
39
|
-
correctly, setting up Capybara and configuring Rails test application
|
|
40
|
-
to precompile assets before the first feature spec.
|
|
37
|
+
module SolidusExtensionName
|
|
38
|
+
class Engine < Rails::Engine
|
|
39
|
+
engine_name 'solidus_extension_name'
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
requireable as a stand-alone helper.
|
|
41
|
+
include SolidusSupport::EngineExtensions
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
require "solidus_support/extension/rails_helper"
|
|
43
|
+
# ...
|
|
44
|
+
end
|
|
45
|
+
end
|
|
49
46
|
```
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
like authorization helpers, Solidus core factories, url helpers, and
|
|
53
|
-
other helpers to easily work with Solidus Config.
|
|
54
|
-
|
|
55
|
-
This `rails_helper` in turn requires the basic `spec_helper`, which is
|
|
56
|
-
responsible to load a basic RSpec configuration, which could be needed
|
|
57
|
-
in all extensions. It is also requireable as a stand-alone helper with:
|
|
48
|
+
If needed, also ensure to remove the original implementation of `.activate`:
|
|
58
49
|
|
|
59
50
|
```ruby
|
|
60
|
-
|
|
51
|
+
def self.activate
|
|
52
|
+
Dir.glob(File.join(root, "app/**/*_decorator*.rb")) do |c|
|
|
53
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
config.to_prepare(&method(:activate).to_proc)
|
|
61
58
|
```
|
|
62
59
|
|
|
63
|
-
|
|
60
|
+
#### Loading files conditionally
|
|
64
61
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
If you include `EngineExtensions` in your extension and structure your files according to the
|
|
63
|
+
expected paths, they will be loaded automagically only when the relevant Solidus engines are
|
|
64
|
+
available.
|
|
68
65
|
|
|
69
|
-
|
|
70
|
-
require "solidus_support/extension/coverage"
|
|
71
|
-
```
|
|
66
|
+
Here's what an example structure may look like:
|
|
72
67
|
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
- `lib/views/backend`: will only be added to the view paths when `solidus_backend` is available.
|
|
69
|
+
- `lib/controllers/backend`: will only be added to the controller paths when `solidus_backend` is
|
|
70
|
+
available.
|
|
71
|
+
- `lib/decorators/backend`: will only be added to the decorator paths when `solidus_backend` is
|
|
72
|
+
available.
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
CircleCI, there's nothing else you need to do - you'll get coverage
|
|
78
|
-
reports for free!
|
|
74
|
+
The same goes for `frontend` and `api`.
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
We strongly recommend following this structure and making your extensions so that they're not
|
|
77
|
+
dependent on anything other than `solidus_core`, only augmenting the functionality of the other
|
|
78
|
+
engines when they are available.
|
|
82
79
|
|
|
83
80
|
## Development
|
|
84
81
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new
|
|
83
|
+
version, update the version number in `version.rb`, and then run `bundle exec rake release`, which
|
|
84
|
+
will create a git tag for the version, push git commits and tags, and push the `.gem` file to
|
|
85
|
+
[rubygems.org](https://rubygems.org).
|
|
88
86
|
|
|
89
87
|
## Contributing
|
|
90
88
|
|
data/Rakefile
CHANGED
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
data/lib/solidus_support.rb
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'solidus_support/version'
|
|
2
4
|
require 'solidus_support/migration'
|
|
5
|
+
require 'solidus_support/engine_extensions'
|
|
3
6
|
require 'solidus_core'
|
|
4
7
|
|
|
5
8
|
module SolidusSupport
|
|
6
9
|
class << self
|
|
7
10
|
def solidus_gem_version
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# 1.0 doesn't have gem_version
|
|
15
|
-
Gem::Specification.detect { |x| x.name == 'solidus_core' }.version
|
|
16
|
-
end
|
|
11
|
+
ActiveSupport::Deprecation.warn <<-WARN.squish, caller
|
|
12
|
+
SolidusSupport.solidus_gem_version is deprecated and will be removed
|
|
13
|
+
in solidus_support 1.0. Please use Spree.solidus_gem_version instead.
|
|
14
|
+
WARN
|
|
15
|
+
|
|
16
|
+
Spree.solidus_gem_version
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def reset_spree_preferences_deprecated?
|
|
20
20
|
first_version_without_reset = Gem::Requirement.new('>= 2.9')
|
|
21
|
-
first_version_without_reset.satisfied_by?(solidus_gem_version)
|
|
21
|
+
first_version_without_reset.satisfied_by?(Spree.solidus_gem_version)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def new_gateway_code?
|
|
25
25
|
first_version_with_new_gateway_code = Gem::Requirement.new('>= 2.3')
|
|
26
|
-
first_version_with_new_gateway_code.satisfied_by?(solidus_gem_version)
|
|
26
|
+
first_version_with_new_gateway_code.satisfied_by?(Spree.solidus_gem_version)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def payment_source_parent_class
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SolidusSupport
|
|
4
|
+
module EngineExtensions
|
|
5
|
+
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
|
6
|
+
deprecate_constant 'Decorators', 'SolidusSupport::EngineExtensions'
|
|
7
|
+
|
|
8
|
+
def self.included(engine)
|
|
9
|
+
engine.extend ClassMethods
|
|
10
|
+
|
|
11
|
+
engine.class_eval do
|
|
12
|
+
solidus_decorators_root.glob('*') do |decorators_folder|
|
|
13
|
+
config.autoload_paths += [decorators_folder]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
config.to_prepare(&method(:activate))
|
|
17
|
+
|
|
18
|
+
enable_solidus_engine_support('backend') if SolidusSupport.backend_available?
|
|
19
|
+
enable_solidus_engine_support('frontend') if SolidusSupport.frontend_available?
|
|
20
|
+
enable_solidus_engine_support('api') if SolidusSupport.api_available?
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
module ClassMethods
|
|
25
|
+
def activate
|
|
26
|
+
load_solidus_decorators_from(solidus_decorators_root)
|
|
27
|
+
load_solidus_subscribers_from(solidus_subscribers_root)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Loads Solidus event subscriber files.
|
|
31
|
+
#
|
|
32
|
+
# This allows to add event subscribers to extensions without explicitly subscribing them,
|
|
33
|
+
# similarly to what happens in Solidus core.
|
|
34
|
+
def load_solidus_subscribers_from(path)
|
|
35
|
+
if defined? Spree::Event
|
|
36
|
+
path.glob("**/*_subscriber.rb") do |subscriber_path|
|
|
37
|
+
require_dependency(subscriber_path)
|
|
38
|
+
end
|
|
39
|
+
Spree::Event.subscribers.each(&:subscribe!)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Loads decorator files.
|
|
44
|
+
#
|
|
45
|
+
# This is needed since they are never explicitly referenced in the application code and
|
|
46
|
+
# won't be loaded by default. We need them to be executed regardless in order to decorate
|
|
47
|
+
# existing classes.
|
|
48
|
+
def load_solidus_decorators_from(path)
|
|
49
|
+
path.glob('**/*.rb') do |decorator_path|
|
|
50
|
+
require_dependency(decorator_path)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
# Returns the root for this engine's decorators.
|
|
57
|
+
#
|
|
58
|
+
# @return [Path]
|
|
59
|
+
def solidus_decorators_root
|
|
60
|
+
root.join('app/decorators')
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Returns the root for this engine's Solidus event subscribers.
|
|
64
|
+
#
|
|
65
|
+
# @return [Path]
|
|
66
|
+
def solidus_subscribers_root
|
|
67
|
+
root.join("app/subscribers")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Enables support for a Solidus engine.
|
|
71
|
+
#
|
|
72
|
+
# This will tell Rails to:
|
|
73
|
+
#
|
|
74
|
+
# * add +lib/controllers/[engine]+ to the controller paths;
|
|
75
|
+
# * add +lib/views/[engine]+ to the view paths;
|
|
76
|
+
# * load the decorators in +lib/decorators/[engine]+.
|
|
77
|
+
#
|
|
78
|
+
# @see #load_solidus_decorators_from
|
|
79
|
+
def enable_solidus_engine_support(engine)
|
|
80
|
+
paths['app/controllers'] << "lib/controllers/#{engine}"
|
|
81
|
+
paths['app/views'] << "lib/views/#{engine}"
|
|
82
|
+
|
|
83
|
+
path = root.join("lib/decorators/#{engine}")
|
|
84
|
+
|
|
85
|
+
config.autoload_paths += path.glob('*')
|
|
86
|
+
|
|
87
|
+
engine_context = self
|
|
88
|
+
config.to_prepare do
|
|
89
|
+
engine_context.instance_eval do
|
|
90
|
+
load_solidus_decorators_from(path)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
data/solidus_support.gemspec
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
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
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
|
22
|
-
spec.add_development_dependency 'rspec-rails', '~> 3.7'
|
|
23
|
-
spec.add_development_dependency 'rubocop'
|
|
24
|
-
spec.add_development_dependency 'rubocop-rspec'
|
|
25
|
-
spec.add_development_dependency 'solidus_core'
|
|
24
|
+
s.add_dependency 'activesupport', ['>= 5.2', '< 7.0.x']
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
s.add_development_dependency 'bundler'
|
|
27
|
+
s.add_development_dependency 'rake'
|
|
28
|
+
s.add_development_dependency 'rspec-rails'
|
|
29
|
+
s.add_development_dependency 'rubocop'
|
|
30
|
+
s.add_development_dependency 'rubocop-rspec'
|
|
31
|
+
s.add_development_dependency 'solidus_core'
|
|
32
|
+
s.add_development_dependency 'solidus_dev_support'
|
|
29
33
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
RSpec.describe SolidusSupport do
|
|
2
4
|
describe '.payment_method_parent_class' do
|
|
3
5
|
subject { described_class.payment_method_parent_class(credit_card: credit_card) }
|
|
@@ -5,37 +7,39 @@ RSpec.describe SolidusSupport do
|
|
|
5
7
|
let(:credit_card) { nil }
|
|
6
8
|
|
|
7
9
|
before do
|
|
8
|
-
allow(
|
|
10
|
+
allow(Spree).to receive(:solidus_gem_version) do
|
|
9
11
|
Gem::Version.new(solidus_version)
|
|
10
12
|
end
|
|
11
13
|
end
|
|
12
14
|
|
|
13
|
-
context '
|
|
15
|
+
context 'with Solidus < 2.3' do
|
|
14
16
|
let(:solidus_version) { '2.2.1' }
|
|
15
17
|
|
|
16
18
|
it { is_expected.to eq(Spree::Gateway) }
|
|
17
19
|
end
|
|
18
20
|
|
|
19
|
-
context '
|
|
21
|
+
context 'with Solidus >= 2.3' do
|
|
20
22
|
let(:solidus_version) { '2.3.1' }
|
|
21
23
|
|
|
22
24
|
it { is_expected.to eq(Spree::PaymentMethod) }
|
|
23
25
|
end
|
|
24
26
|
|
|
27
|
+
# rubocop:disable RSpec/NestedGroups
|
|
25
28
|
context 'with credit_card: true' do
|
|
26
29
|
let(:credit_card) { true }
|
|
27
30
|
|
|
28
|
-
context '
|
|
31
|
+
context 'with Solidus < 2.3' do
|
|
29
32
|
let(:solidus_version) { '2.2.1' }
|
|
30
33
|
|
|
31
34
|
it { is_expected.to eq(Spree::Gateway) }
|
|
32
35
|
end
|
|
33
36
|
|
|
34
|
-
context '
|
|
37
|
+
context 'with Solidus >= 2.3' do
|
|
35
38
|
let(:solidus_version) { '2.3.1' }
|
|
36
39
|
|
|
37
40
|
it { is_expected.to eq(Spree::PaymentMethod::CreditCard) }
|
|
38
41
|
end
|
|
39
42
|
end
|
|
43
|
+
# rubocop:enable RSpec/NestedGroups
|
|
40
44
|
end
|
|
41
45
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,2 +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
|
|
1
10
|
require_relative 'support/dummy_app'
|
|
2
|
-
|
|
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 }
|
data/spec/support/dummy_app.rb
CHANGED
|
@@ -1,4 +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 %>
|
|
1
12
|
test:
|
|
2
13
|
adapter: sqlite3
|
|
3
14
|
database: ':memory:'
|
|
4
15
|
timeout: 10000
|
|
16
|
+
<% end %>
|
metadata
CHANGED
|
@@ -1,59 +1,65 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_support
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Hawthorn
|
|
8
|
-
autorequire:
|
|
9
|
-
bindir:
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-07-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: activesupport
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
20
|
-
|
|
19
|
+
version: '5.2'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 7.0.x
|
|
23
|
+
type: :runtime
|
|
21
24
|
prerelease: false
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
26
|
requirements:
|
|
24
|
-
- - "
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '5.2'
|
|
30
|
+
- - "<"
|
|
25
31
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
32
|
+
version: 7.0.x
|
|
27
33
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
34
|
+
name: bundler
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
|
30
36
|
requirements:
|
|
31
|
-
- - "
|
|
37
|
+
- - ">="
|
|
32
38
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
39
|
+
version: '0'
|
|
34
40
|
type: :development
|
|
35
41
|
prerelease: false
|
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
43
|
requirements:
|
|
38
|
-
- - "
|
|
44
|
+
- - ">="
|
|
39
45
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
46
|
+
version: '0'
|
|
41
47
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
48
|
+
name: rake
|
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
|
44
50
|
requirements:
|
|
45
|
-
- - "
|
|
51
|
+
- - ">="
|
|
46
52
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
53
|
+
version: '0'
|
|
48
54
|
type: :development
|
|
49
55
|
prerelease: false
|
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
57
|
requirements:
|
|
52
|
-
- - "
|
|
58
|
+
- - ">="
|
|
53
59
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
60
|
+
version: '0'
|
|
55
61
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
62
|
+
name: rspec-rails
|
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
|
58
64
|
requirements:
|
|
59
65
|
- - ">="
|
|
@@ -67,7 +73,7 @@ dependencies:
|
|
|
67
73
|
- !ruby/object:Gem::Version
|
|
68
74
|
version: '0'
|
|
69
75
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rubocop
|
|
76
|
+
name: rubocop
|
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
|
72
78
|
requirements:
|
|
73
79
|
- - ">="
|
|
@@ -81,7 +87,7 @@ dependencies:
|
|
|
81
87
|
- !ruby/object:Gem::Version
|
|
82
88
|
version: '0'
|
|
83
89
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
90
|
+
name: rubocop-rspec
|
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
|
86
92
|
requirements:
|
|
87
93
|
- - ">="
|
|
@@ -95,13 +101,13 @@ dependencies:
|
|
|
95
101
|
- !ruby/object:Gem::Version
|
|
96
102
|
version: '0'
|
|
97
103
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
104
|
+
name: solidus_core
|
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
|
100
106
|
requirements:
|
|
101
107
|
- - ">="
|
|
102
108
|
- !ruby/object:Gem::Version
|
|
103
109
|
version: '0'
|
|
104
|
-
type: :
|
|
110
|
+
type: :development
|
|
105
111
|
prerelease: false
|
|
106
112
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
113
|
requirements:
|
|
@@ -109,50 +115,52 @@ dependencies:
|
|
|
109
115
|
- !ruby/object:Gem::Version
|
|
110
116
|
version: '0'
|
|
111
117
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
118
|
+
name: solidus_dev_support
|
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
|
114
120
|
requirements:
|
|
115
121
|
- - ">="
|
|
116
122
|
- !ruby/object:Gem::Version
|
|
117
123
|
version: '0'
|
|
118
|
-
type: :
|
|
124
|
+
type: :development
|
|
119
125
|
prerelease: false
|
|
120
126
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
127
|
requirements:
|
|
122
128
|
- - ">="
|
|
123
129
|
- !ruby/object:Gem::Version
|
|
124
130
|
version: '0'
|
|
125
|
-
description:
|
|
126
|
-
email:
|
|
127
|
-
- john@stembolt.com
|
|
131
|
+
description:
|
|
132
|
+
email: john@stembolt.com
|
|
128
133
|
executables: []
|
|
129
134
|
extensions: []
|
|
130
135
|
extra_rdoc_files: []
|
|
131
136
|
files:
|
|
137
|
+
- ".circleci/config.yml"
|
|
138
|
+
- ".gem_release.yml"
|
|
139
|
+
- ".github/stale.yml"
|
|
132
140
|
- ".gitignore"
|
|
133
141
|
- ".rspec"
|
|
134
142
|
- ".rubocop.yml"
|
|
135
|
-
-
|
|
143
|
+
- CHANGELOG.md
|
|
136
144
|
- Gemfile
|
|
145
|
+
- LICENSE
|
|
137
146
|
- README.md
|
|
138
147
|
- Rakefile
|
|
148
|
+
- bin/console
|
|
149
|
+
- bin/setup
|
|
139
150
|
- lib/solidus_support.rb
|
|
140
|
-
- lib/solidus_support/
|
|
141
|
-
- lib/solidus_support/extension/feature_helper.rb
|
|
142
|
-
- lib/solidus_support/extension/rails_helper.rb
|
|
143
|
-
- lib/solidus_support/extension/spec_helper.rb
|
|
151
|
+
- lib/solidus_support/engine_extensions.rb
|
|
144
152
|
- lib/solidus_support/migration.rb
|
|
145
|
-
- lib/solidus_support/testing_support/preferences.rb
|
|
146
153
|
- lib/solidus_support/version.rb
|
|
147
154
|
- solidus_support.gemspec
|
|
148
155
|
- spec/solidus_support_spec.rb
|
|
149
156
|
- spec/spec_helper.rb
|
|
150
157
|
- spec/support/dummy_app.rb
|
|
151
158
|
- spec/support/dummy_app/database.yml
|
|
152
|
-
homepage: https://
|
|
153
|
-
licenses:
|
|
159
|
+
homepage: https://github.com/solidusio/solidus_support
|
|
160
|
+
licenses:
|
|
161
|
+
- BSD-3-Clause
|
|
154
162
|
metadata: {}
|
|
155
|
-
post_install_message:
|
|
163
|
+
post_install_message:
|
|
156
164
|
rdoc_options: []
|
|
157
165
|
require_paths:
|
|
158
166
|
- lib
|
|
@@ -167,8 +175,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
167
175
|
- !ruby/object:Gem::Version
|
|
168
176
|
version: '0'
|
|
169
177
|
requirements: []
|
|
170
|
-
rubygems_version: 3.0.
|
|
171
|
-
signing_key:
|
|
178
|
+
rubygems_version: 3.0.8
|
|
179
|
+
signing_key:
|
|
172
180
|
specification_version: 4
|
|
173
|
-
summary:
|
|
174
|
-
test_files:
|
|
181
|
+
summary: Common runtime helpers for Solidus extensions.
|
|
182
|
+
test_files:
|
|
183
|
+
- spec/spec_helper.rb
|
|
184
|
+
- spec/solidus_support_spec.rb
|
|
185
|
+
- spec/support/dummy_app.rb
|
|
186
|
+
- 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
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# A SimpleCov and Codecov configuration to track code coverage in your extension
|
|
2
|
-
#
|
|
3
|
-
# Include it AT THE TOP of your spec/spec_helper.rb:
|
|
4
|
-
#
|
|
5
|
-
# require 'solidus_support/extension/coverage'
|
|
6
|
-
#
|
|
7
|
-
# Note that things may not work properly if you don't include this at the very top!
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
require 'simplecov'
|
|
11
|
-
SimpleCov.start 'rails'
|
|
12
|
-
|
|
13
|
-
if ENV['CI']
|
|
14
|
-
require 'codecov'
|
|
15
|
-
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
|
16
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# A basic feature_helper to be included as the starting point for extensions
|
|
2
|
-
#
|
|
3
|
-
# Can be required from an extension's spec/feature_helper.rb
|
|
4
|
-
#
|
|
5
|
-
# require 'solidus_support/extension/feature_helper'
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
require 'solidus_support/extension/rails_helper'
|
|
9
|
-
|
|
10
|
-
require 'capybara-screenshot/rspec'
|
|
11
|
-
require 'selenium/webdriver'
|
|
12
|
-
|
|
13
|
-
Capybara.register_driver :selenium_chrome_headless do |app|
|
|
14
|
-
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
|
15
|
-
chromeOptions: { args: %w[headless start-maximized] }
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
Capybara::Selenium::Driver.new(
|
|
19
|
-
app,
|
|
20
|
-
browser: :chrome,
|
|
21
|
-
desired_capabilities: capabilities
|
|
22
|
-
)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
Capybara.javascript_driver = (ENV['CAPYBARA_DRIVER'] || :selenium_chrome_headless).to_sym
|
|
26
|
-
Capybara.default_max_wait_time = 10
|
|
27
|
-
|
|
28
|
-
require 'spree/testing_support/capybara_ext'
|
|
29
|
-
|
|
30
|
-
RSpec.configure do |config|
|
|
31
|
-
config.when_first_matching_example_defined(type: :feature) do
|
|
32
|
-
config.before :suite do
|
|
33
|
-
# Preload assets
|
|
34
|
-
if Rails.application.respond_to?(:precompiled_assets)
|
|
35
|
-
Rails.application.precompiled_assets
|
|
36
|
-
else
|
|
37
|
-
# For older sprockets 2.x
|
|
38
|
-
Rails.application.config.assets.precompile.each do |asset|
|
|
39
|
-
Rails.application.assets.find_asset(asset)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# A basic rails_helper to be included as the starting point for extensions
|
|
2
|
-
#
|
|
3
|
-
# Can be required from an extension's spec/rails_helper.rb
|
|
4
|
-
#
|
|
5
|
-
# require 'solidus_support/extension/rails_helper'
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
require 'solidus_support/extension/spec_helper'
|
|
9
|
-
|
|
10
|
-
require 'rspec/rails'
|
|
11
|
-
require 'database_cleaner'
|
|
12
|
-
require 'ffaker'
|
|
13
|
-
|
|
14
|
-
require 'spree/testing_support/authorization_helpers'
|
|
15
|
-
require 'spree/testing_support/factories'
|
|
16
|
-
require 'spree/testing_support/url_helpers'
|
|
17
|
-
require 'spree/testing_support/preferences'
|
|
18
|
-
require 'solidus_support/testing_support/preferences'
|
|
19
|
-
|
|
20
|
-
RSpec.configure do |config|
|
|
21
|
-
config.include FactoryBot::Syntax::Methods
|
|
22
|
-
|
|
23
|
-
# visit spree.admin_path
|
|
24
|
-
# current_path.should eql(spree.products_path)
|
|
25
|
-
config.include Spree::TestingSupport::UrlHelpers
|
|
26
|
-
|
|
27
|
-
config.include Spree::TestingSupport::Preferences
|
|
28
|
-
config.include SolidusSupport::TestingSupport::Preferences
|
|
29
|
-
|
|
30
|
-
config.before :suite do
|
|
31
|
-
DatabaseCleaner.clean_with :truncation
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Around each spec check if it is a Javascript test and switch between using
|
|
35
|
-
# database transactions or not where necessary.
|
|
36
|
-
config.around(:each) do |example|
|
|
37
|
-
DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction
|
|
38
|
-
|
|
39
|
-
DatabaseCleaner.cleaning do
|
|
40
|
-
reset_spree_preferences unless SolidusSupport.reset_spree_preferences_deprecated?
|
|
41
|
-
|
|
42
|
-
example.run
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# A basic spec_helper to be included as the starting point for extensions
|
|
2
|
-
#
|
|
3
|
-
# Can be required from an extension's spec/spec_helper.rb
|
|
4
|
-
#
|
|
5
|
-
# require 'solidus_support/extension/spec_helper'
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
RSpec.configure do |config|
|
|
9
|
-
config.filter_run focus: true
|
|
10
|
-
config.run_all_when_everything_filtered = true
|
|
11
|
-
|
|
12
|
-
config.mock_with :rspec
|
|
13
|
-
config.color = true
|
|
14
|
-
|
|
15
|
-
config.fail_fast = ENV['FAIL_FAST'] || false
|
|
16
|
-
config.order = 'random'
|
|
17
|
-
|
|
18
|
-
Kernel.srand config.seed
|
|
19
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module SolidusSupport
|
|
4
|
-
module TestingSupport
|
|
5
|
-
module Preferences
|
|
6
|
-
# This wrapper method allows to stub spree preferences using
|
|
7
|
-
# the new standard way of solidus core but also works with
|
|
8
|
-
# old versions that does not have the stub_spree_preferences
|
|
9
|
-
# method yet. This way we can start using this method in our
|
|
10
|
-
# extensions safely.
|
|
11
|
-
#
|
|
12
|
-
# To have this available, it is needed to require in the
|
|
13
|
-
# spec/spec_helper.rb of the extension both:
|
|
14
|
-
#
|
|
15
|
-
# require 'spree/testing_support/preferences'
|
|
16
|
-
# require 'solidus_support/testing_support/preferences'
|
|
17
|
-
#
|
|
18
|
-
# @example Set a preference on Spree::Config
|
|
19
|
-
# stub_spree_preferences(allow_guest_checkout: false)
|
|
20
|
-
#
|
|
21
|
-
# @example Set a preference on Spree::Api::Config
|
|
22
|
-
# stub_spree_preferences(Spree::Api::Config, requires_authentication: false)
|
|
23
|
-
#
|
|
24
|
-
# @example Set a preference on a custom Spree::CustomExtension::Config
|
|
25
|
-
# stub_spree_preferences(Spree::CustomExtension::Config, custom_pref: true)
|
|
26
|
-
#
|
|
27
|
-
# @param prefs_or_conf_class [Class, Hash] the class we want to stub
|
|
28
|
-
# preferences for or the preferences hash (see prefs param). If this
|
|
29
|
-
# param is an Hash, preferences will be stubbed on Spree::Config.
|
|
30
|
-
# @param prefs [Hash, nil] names and values to be stubbed
|
|
31
|
-
def stub_spree_preferences(prefs_or_conf_class, prefs = nil)
|
|
32
|
-
super && return if SolidusSupport.reset_spree_preferences_deprecated?
|
|
33
|
-
|
|
34
|
-
if prefs_or_conf_class.is_a?(Hash)
|
|
35
|
-
preference_store_class = Spree::Config
|
|
36
|
-
preferences = prefs_or_conf_class
|
|
37
|
-
else
|
|
38
|
-
preference_store_class = prefs_or_conf_class
|
|
39
|
-
preferences = prefs
|
|
40
|
-
end
|
|
41
|
-
preference_store_class.set(preferences)
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|