solidus_dev_support 2.10.0 → 2.12.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/.git-blame-ignore-revs +3 -0
- data/.github/workflows/lint.yml +25 -0
- data/.github/workflows/test.yml +64 -0
- data/.rubocop.yml +4 -55
- data/.standard.yml +2 -0
- data/Gemfile +15 -11
- data/README.md +26 -6
- data/bin/setup +5 -5
- data/bin/solidus +1 -1
- data/exe/solidus +1 -1
- data/lib/solidus_dev_support/extension.rb +38 -38
- data/lib/solidus_dev_support/rake_tasks.rb +18 -18
- data/lib/solidus_dev_support/rspec/capybara.rb +5 -5
- data/lib/solidus_dev_support/rspec/coverage.rb +13 -5
- data/lib/solidus_dev_support/rspec/feature_helper.rb +2 -2
- data/lib/solidus_dev_support/rspec/rails_helper.rb +14 -14
- data/lib/solidus_dev_support/rspec/spec_helper.rb +2 -2
- data/lib/solidus_dev_support/rubocop/config.yml +11 -80
- data/lib/solidus_dev_support/solidus_command.rb +10 -10
- data/lib/solidus_dev_support/templates/extension/.github/workflows/lint.yml +25 -0
- data/lib/solidus_dev_support/templates/extension/.github/workflows/test.yml +71 -0
- data/lib/solidus_dev_support/templates/extension/Gemfile.tt +12 -5
- data/lib/solidus_dev_support/templates/extension/Rakefile +2 -2
- data/lib/solidus_dev_support/templates/extension/bin/rails-sandbox +4 -4
- data/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +8 -0
- data/lib/solidus_dev_support/templates/extension/extension.gemspec.tt +1 -1
- data/lib/solidus_dev_support/testing_support/factories.rb +5 -5
- data/lib/solidus_dev_support/version.rb +1 -1
- data/lib/solidus_dev_support.rb +1 -1
- data/solidus_dev_support.gemspec +28 -31
- metadata +28 -62
- data/.circleci/config.yml +0 -63
- data/.rubocop-https---relaxed-ruby-style-rubocop-yml +0 -153
- data/spec/features/create_extension_spec.rb +0 -193
- data/spec/lib/extension_spec.rb +0 -69
- data/spec/spec_helper.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c49ae4d2deb84c0553914b4f61ede1fc0b9cd9a75e70059e62c5b73663b81a20
|
4
|
+
data.tar.gz: 19a09ea4d8124daddd02a97e704a1a05a3899e54e2dbebd85f5b1a0f7183ae5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a21b8d5d4f1c8721ba209d4567635845ce3a5e5de263b835efc643f5dc01fe08595fd99cf7eb6834fdfa58b51c462f01d4d48092bcd40b56a06f359430a47713
|
7
|
+
data.tar.gz: 670466076e0920328af99f84e9a2910a36f7702af598aae33637d6b2211038547fd7a9f8a4e77a455c79a15393a9aa7fc4bbc70266e9aac5d386b25108ff040e
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Lint
|
2
|
+
|
3
|
+
on: [pull_request]
|
4
|
+
|
5
|
+
concurrency:
|
6
|
+
group: lint-${{ github.ref_name }}
|
7
|
+
cancel-in-progress: ${{ github.ref_name != 'main' }}
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
ruby:
|
14
|
+
name: Check Ruby
|
15
|
+
runs-on: ubuntu-24.04
|
16
|
+
steps:
|
17
|
+
- name: Checkout code
|
18
|
+
uses: actions/checkout@v3
|
19
|
+
- name: Install Ruby and gems
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: "3.2"
|
23
|
+
bundler-cache: true
|
24
|
+
- name: Lint Ruby files
|
25
|
+
run: bundle exec rubocop -ESP
|
@@ -0,0 +1,64 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
pull_request:
|
8
|
+
schedule:
|
9
|
+
- cron: "0 0 * * 4" # every Thursday
|
10
|
+
|
11
|
+
concurrency:
|
12
|
+
group: test-${{ github.ref_name }}
|
13
|
+
cancel-in-progress: ${{ github.ref_name != 'main' }}
|
14
|
+
|
15
|
+
permissions:
|
16
|
+
contents: read
|
17
|
+
|
18
|
+
jobs:
|
19
|
+
rspec:
|
20
|
+
name: Solidus ${{ matrix.solidus-branch }}, Rails ${{ matrix.rails-version }} and Ruby ${{ matrix.ruby-version }} on ${{ matrix.database }}
|
21
|
+
runs-on: ubuntu-24.04
|
22
|
+
strategy:
|
23
|
+
fail-fast: true
|
24
|
+
matrix:
|
25
|
+
rails-version:
|
26
|
+
- "7.1"
|
27
|
+
- "7.2"
|
28
|
+
- "8.0"
|
29
|
+
ruby-version:
|
30
|
+
- "3.1"
|
31
|
+
- "3.4"
|
32
|
+
solidus-branch:
|
33
|
+
- "v4.3"
|
34
|
+
- "v4.4"
|
35
|
+
- "v4.5"
|
36
|
+
- "main"
|
37
|
+
database:
|
38
|
+
- "postgresql"
|
39
|
+
- "mysql"
|
40
|
+
- "sqlite"
|
41
|
+
exclude:
|
42
|
+
- rails-version: "7.2"
|
43
|
+
solidus-branch: "v4.3"
|
44
|
+
- ruby-version: "3.1"
|
45
|
+
rails-version: "8.0"
|
46
|
+
- solidus-branch: "v4.3"
|
47
|
+
rails-version: "8.0"
|
48
|
+
- solidus-branch: "v4.4"
|
49
|
+
rails-version: "8.0"
|
50
|
+
steps:
|
51
|
+
- uses: actions/checkout@v4
|
52
|
+
- name: Run extension tests
|
53
|
+
uses: solidusio/test-solidus-extension@main
|
54
|
+
with:
|
55
|
+
database: ${{ matrix.database }}
|
56
|
+
rails-version: ${{ matrix.rails-version }}
|
57
|
+
ruby-version: ${{ matrix.ruby-version }}
|
58
|
+
solidus-branch: ${{ matrix.solidus-branch }}
|
59
|
+
- name: Upload coverage reports to Codecov
|
60
|
+
uses: codecov/codecov-action@v5
|
61
|
+
continue-on-error: true
|
62
|
+
with:
|
63
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
64
|
+
files: ./coverage/coverage.xml
|
data/.rubocop.yml
CHANGED
@@ -1,59 +1,8 @@
|
|
1
|
-
|
2
|
-
-
|
1
|
+
require:
|
2
|
+
- standard
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
Layout/EmptyLinesAroundAttributeAccessor:
|
7
|
-
Enabled: true
|
8
|
-
Layout/SpaceAroundMethodCallOperator:
|
9
|
-
Enabled: true
|
10
|
-
Lint/DeprecatedOpenSSLConstant:
|
11
|
-
Enabled: true
|
12
|
-
Lint/MixedRegexpCaptureTypes:
|
13
|
-
Enabled: true
|
14
|
-
Lint/RaiseException:
|
15
|
-
Enabled: true
|
16
|
-
Lint/StructNewOverride:
|
17
|
-
Enabled: true
|
18
|
-
Style/AccessorGrouping:
|
19
|
-
Enabled: true
|
20
|
-
Style/BisectedAttrAccessor:
|
21
|
-
Enabled: true
|
22
|
-
Style/ExponentialNotation:
|
23
|
-
Enabled: true
|
24
|
-
Style/HashEachMethods:
|
25
|
-
Enabled: true
|
26
|
-
Style/HashTransformKeys:
|
27
|
-
Enabled: true
|
28
|
-
Style/HashTransformValues:
|
29
|
-
Enabled: true
|
30
|
-
Style/RedundantAssignment:
|
31
|
-
Enabled: true
|
32
|
-
Style/RedundantFetchBlock:
|
33
|
-
Enabled: true
|
34
|
-
Style/RedundantRegexpCharacterClass:
|
35
|
-
Enabled: true
|
36
|
-
Style/RedundantRegexpEscape:
|
37
|
-
Enabled: true
|
38
|
-
Style/SlicingWithRange:
|
39
|
-
Enabled: true
|
40
|
-
|
41
|
-
# Disable this cop until this isssue gets a clear answer:
|
42
|
-
# https://github.com/rubocop/rubocop/issues/10675
|
43
|
-
Gemspec/DeprecatedAttributeAssignment:
|
44
|
-
Enabled: false
|
4
|
+
inherit_gem:
|
5
|
+
standard: config/base.yml
|
45
6
|
|
46
7
|
AllCops:
|
47
8
|
TargetRubyVersion: 3.0
|
48
|
-
Exclude:
|
49
|
-
- tmp/**/*
|
50
|
-
- "vendor/**/*"
|
51
|
-
# Generated binstubs
|
52
|
-
- bin/rake
|
53
|
-
NewCops: enable
|
54
|
-
|
55
|
-
Style/FrozenStringLiteralComment:
|
56
|
-
Exclude:
|
57
|
-
- "**/bin/*"
|
58
|
-
- "**/exe/*"
|
59
|
-
- "spec/**/*"
|
data/.standard.yml
ADDED
data/Gemfile
CHANGED
@@ -7,23 +7,27 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
7
7
|
# Specify your gem's dependencies in solidus_dev_support.gemspec
|
8
8
|
gemspec
|
9
9
|
|
10
|
-
branch = ENV.fetch(
|
11
|
-
gem
|
10
|
+
branch = ENV.fetch("SOLIDUS_BRANCH", "main")
|
11
|
+
gem "solidus", github: "solidusio/solidus", branch: branch
|
12
12
|
|
13
|
-
|
14
|
-
gem
|
13
|
+
rails_version = ENV.fetch("RAILS_VERSION", "7.0")
|
14
|
+
gem "rails", "~> #{rails_version}"
|
15
15
|
|
16
|
-
gem
|
17
|
-
gem
|
16
|
+
gem "bundler"
|
17
|
+
gem "rake"
|
18
18
|
|
19
19
|
# These gems will be used by the temporary extensions generated by tests
|
20
20
|
group :test do
|
21
|
-
gem
|
22
|
-
gem
|
23
|
-
gem
|
24
|
-
gem
|
21
|
+
gem "mysql2"
|
22
|
+
gem "pg"
|
23
|
+
gem "solidus_auth_devise"
|
24
|
+
gem "sqlite3", (rails_version < "7.2") ? "~> 1.4" : "~> 2.0"
|
25
25
|
end
|
26
26
|
|
27
27
|
# Use a local Gemfile to include development dependencies that might not be
|
28
28
|
# relevant for the project or for other contributors, e.g.: `gem 'pry-debug'`.
|
29
|
-
eval_gemfile
|
29
|
+
eval_gemfile "Gemfile-local" if File.exist? "Gemfile-local"
|
30
|
+
|
31
|
+
if rails_version == "7.0"
|
32
|
+
gem "concurrent-ruby", "< 1.3.5"
|
33
|
+
end
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# solidus_dev_support
|
2
2
|
|
3
3
|
|
4
|
-
[](https://github.com/solidusio/solidus_dev_support/actions/workflows/test.yml)
|
5
5
|
[](https://codecov.io/gh/solidusio/solidus_dev_support)
|
6
6
|
|
7
7
|
This gem contains common development functionality for Solidus extensions.
|
@@ -138,17 +138,37 @@ require 'solidus_dev_support/rspec/coverage'
|
|
138
138
|
**Note: Make sure to add this at the VERY TOP of your spec_helper, otherwise you'll get skewed
|
139
139
|
coverage reports!**
|
140
140
|
|
141
|
-
If your extension is in a public repo and being tested on
|
141
|
+
If your extension is in a public repo and being tested on GitHub actions, there's nothing else
|
142
142
|
you need to do! If your setup is more complex, look at the
|
143
143
|
[SimpleCov](https://github.com/colszowka/simplecov)
|
144
|
-
and [codecov
|
144
|
+
and [codecov](https://about.codecov.io/language/ruby/) docs.
|
145
|
+
|
146
|
+
#### Using GitHub Actions
|
147
|
+
|
148
|
+
The recommended way to upload coverage reports to Codecov with GitHub Actions is to use the `solidusio/test-solidus-extension`
|
149
|
+
workflow.
|
150
|
+
|
151
|
+
```yaml
|
152
|
+
jobs:
|
153
|
+
RSpec:
|
154
|
+
env:
|
155
|
+
CODECOV_COVERAGE_PATH: ./coverage/coverage.xml
|
156
|
+
steps:
|
157
|
+
- uses: actions/checkout@v4
|
158
|
+
- name: Run extension tests
|
159
|
+
uses: solidusio/test-solidus-extension@main
|
160
|
+
- name: Upload coverage reports to Codecov
|
161
|
+
uses: codecov/codecov-action@v5
|
162
|
+
continue-on-error: true
|
163
|
+
with:
|
164
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
165
|
+
files: ${{ env.CODECOV_COVERAGE_PATH }}
|
166
|
+
```
|
145
167
|
|
146
168
|
### RuboCop configuration
|
147
169
|
|
148
170
|
solidus_dev_support includes a default [RuboCop](https://github.com/rubocop-hq/rubocop)
|
149
|
-
configuration for Solidus extensions.
|
150
|
-
[Relaxed Ruby Style](https://relaxed.ruby.style) with a few customizations, but in the future we
|
151
|
-
plan to provide custom cops to ensure your extension follows established Solidus best practices.
|
171
|
+
configuration for Solidus extensions. This configuration is based on the excellent [`standardrb`](https://github.com/standardrb/standard) gem.
|
152
172
|
|
153
173
|
We strongly recommend including the RuboCop configuration in your extension. All you have to do is
|
154
174
|
add this to your `.rubocop.yml`:
|
data/bin/setup
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
2
|
+
require "fileutils"
|
3
3
|
include FileUtils # rubocop:disable Style/MixinUsage
|
4
4
|
|
5
|
-
GEM_ROOT = File.expand_path(
|
5
|
+
GEM_ROOT = File.expand_path("..", __dir__)
|
6
6
|
|
7
7
|
def system(*args)
|
8
|
-
puts "$ #{args.size == 1 ? args.first : args.shelljoin}"
|
8
|
+
puts "$ #{(args.size == 1) ? args.first : args.shelljoin}"
|
9
9
|
super
|
10
10
|
end
|
11
11
|
|
@@ -16,5 +16,5 @@ end
|
|
16
16
|
cd GEM_ROOT
|
17
17
|
|
18
18
|
puts "\n== Installing Ruby dependencies =="
|
19
|
-
system! %
|
20
|
-
system! %
|
19
|
+
system! %(gem install bundler --conservative)
|
20
|
+
system! %(bundle check || bundle install)
|
data/bin/solidus
CHANGED
data/exe/solidus
CHANGED
@@ -1,47 +1,47 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "thor"
|
4
|
+
require "pathname"
|
5
5
|
|
6
|
-
require
|
6
|
+
require "solidus_dev_support/version"
|
7
7
|
|
8
8
|
module SolidusDevSupport
|
9
9
|
class Extension < Thor
|
10
10
|
include Thor::Actions
|
11
|
-
PREFIX =
|
11
|
+
PREFIX = "solidus_"
|
12
12
|
|
13
13
|
default_command :generate
|
14
14
|
|
15
|
-
desc
|
16
|
-
def generate(raw_path =
|
15
|
+
desc "generate PATH", "Generates a new Solidus extension"
|
16
|
+
def generate(raw_path = ".")
|
17
17
|
self.path = raw_path
|
18
18
|
|
19
19
|
empty_directory path
|
20
20
|
|
21
|
-
directory
|
22
|
-
directory
|
23
|
-
directory
|
24
|
-
directory
|
25
|
-
directory
|
21
|
+
directory "app", "#{path}/app"
|
22
|
+
directory "lib", "#{path}/lib"
|
23
|
+
directory "bin", "#{path}/bin"
|
24
|
+
directory ".circleci", "#{path}/.circleci"
|
25
|
+
directory ".github", "#{path}/.github"
|
26
26
|
|
27
27
|
Dir["#{path}/bin/*"].each do |bin|
|
28
28
|
make_executable bin
|
29
29
|
end
|
30
30
|
|
31
|
-
template
|
32
|
-
template
|
33
|
-
template
|
34
|
-
template
|
35
|
-
template
|
36
|
-
template
|
37
|
-
template
|
38
|
-
template
|
39
|
-
template
|
40
|
-
template
|
41
|
-
template
|
42
|
-
template
|
43
|
-
template
|
44
|
-
template
|
31
|
+
template "CHANGELOG.md", "#{path}/CHANGELOG.md"
|
32
|
+
template "extension.gemspec", "#{path}/#{file_name}.gemspec"
|
33
|
+
template "Gemfile", "#{path}/Gemfile"
|
34
|
+
template "gitignore", "#{path}/.gitignore"
|
35
|
+
template "gem_release.yml.tt", "#{path}/.gem_release.yml"
|
36
|
+
template "LICENSE", "#{path}/LICENSE"
|
37
|
+
template "Rakefile", "#{path}/Rakefile"
|
38
|
+
template "README.md", "#{path}/README.md"
|
39
|
+
template "config/routes.rb", "#{path}/config/routes.rb"
|
40
|
+
template "config/locales/en.yml", "#{path}/config/locales/en.yml"
|
41
|
+
template "rspec", "#{path}/.rspec"
|
42
|
+
template "spec/spec_helper.rb.tt", "#{path}/spec/spec_helper.rb"
|
43
|
+
template "rubocop.yml", "#{path}/.rubocop.yml"
|
44
|
+
template "github_changelog_generator", "#{path}/.github_changelog_generator"
|
45
45
|
end
|
46
46
|
|
47
47
|
no_tasks do
|
@@ -70,17 +70,17 @@ module SolidusDevSupport
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def default_gemspec
|
73
|
-
@default_gemspec ||= Gem::Specification.new(file_name,
|
74
|
-
gem.author = git(
|
75
|
-
gem.email = git(
|
73
|
+
@default_gemspec ||= Gem::Specification.new(file_name, "0.0.1") do |gem|
|
74
|
+
gem.author = git("config user.name", "TODO: Write your name")
|
75
|
+
gem.email = git("config user.email", "TODO: Write your email address")
|
76
76
|
|
77
|
-
gem.summary =
|
78
|
-
gem.description =
|
79
|
-
gem.license =
|
77
|
+
gem.summary = "TODO: Write a short summary, because RubyGems requires one."
|
78
|
+
gem.description = "TODO: Write a longer description or delete this line."
|
79
|
+
gem.license = "BSD-3-Clause"
|
80
80
|
|
81
|
-
gem.metadata[
|
82
|
-
gem.metadata[
|
83
|
-
gem.metadata[
|
81
|
+
gem.metadata["homepage_uri"] = gem.homepage = "https://github.com/#{repo}#readme"
|
82
|
+
gem.metadata["changelog_uri"] = "https://github.com/#{repo}/blob/main/CHANGELOG.md"
|
83
|
+
gem.metadata["source_code_uri"] = "https://github.com/#{repo}"
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -95,9 +95,9 @@ module SolidusDevSupport
|
|
95
95
|
spec.license ||= default_gemspec.license
|
96
96
|
|
97
97
|
spec.homepage ||= default_gemspec.homepage
|
98
|
-
spec.metadata[
|
99
|
-
spec.metadata[
|
100
|
-
spec.metadata[
|
98
|
+
spec.metadata["source_code_uri"] ||= default_gemspec.metadata["source_code_uri"]
|
99
|
+
spec.metadata["changelog_uri"] ||= default_gemspec.metadata["changelog_uri"]
|
100
|
+
spec.metadata["source_code_uri"] ||= default_gemspec.metadata["source_code_uri"]
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -106,7 +106,7 @@ module SolidusDevSupport
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def existing_repo
|
109
|
-
git(
|
109
|
+
git("remote get-url origin")&.sub(%r{^.*github\.com.([^/]+)/([^/.]+).*$}, '\1/\2')
|
110
110
|
end
|
111
111
|
|
112
112
|
def git(command, default = nil)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "rake"
|
4
|
+
require "pathname"
|
5
5
|
|
6
6
|
module SolidusDevSupport
|
7
7
|
class RakeTasks
|
@@ -13,7 +13,7 @@ module SolidusDevSupport
|
|
13
13
|
|
14
14
|
def initialize(root: Dir.pwd, user_class: "Spree::LegacyUser")
|
15
15
|
@root = Pathname(root)
|
16
|
-
@test_app_path = @root.join(ENV.fetch(
|
16
|
+
@test_app_path = @root.join(ENV.fetch("DUMMY_PATH", "spec/dummy"))
|
17
17
|
@gemspec = Bundler.load_gemspec(@root.glob("{,*}.gemspec").first)
|
18
18
|
@user_class = user_class
|
19
19
|
end
|
@@ -28,11 +28,11 @@ module SolidusDevSupport
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def install_test_app_task
|
31
|
-
require
|
32
|
-
require
|
31
|
+
require "rake/clean"
|
32
|
+
require "spree/testing_support/extension_rake"
|
33
33
|
|
34
|
-
ENV[
|
35
|
-
ENV[
|
34
|
+
ENV["DUMMY_PATH"] = test_app_path.to_s
|
35
|
+
ENV["LIB_NAME"] = gemspec.name
|
36
36
|
|
37
37
|
::CLOBBER.include test_app_path
|
38
38
|
|
@@ -40,12 +40,12 @@ module SolidusDevSupport
|
|
40
40
|
# We need to go back to the gem root since the upstream
|
41
41
|
# extension:test_app changes the working directory to be the dummy app.
|
42
42
|
task :test_app do
|
43
|
-
Rake::Task[
|
43
|
+
Rake::Task["extension:test_app"].invoke(@user_class)
|
44
44
|
cd root
|
45
45
|
end
|
46
46
|
|
47
|
-
directory ENV.fetch(
|
48
|
-
Rake::Task[
|
47
|
+
directory ENV.fetch("DUMMY_PATH", nil) do
|
48
|
+
Rake::Task["extension:test_app"].invoke(@user_class)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -59,31 +59,31 @@ module SolidusDevSupport
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def install_rspec_task
|
62
|
-
require
|
62
|
+
require "rspec/core/rake_task"
|
63
63
|
|
64
64
|
namespace :extension do
|
65
|
-
::RSpec::Core::RakeTask.new(:specs, [] => FileList[ENV.fetch(
|
65
|
+
::RSpec::Core::RakeTask.new(:specs, [] => FileList[ENV.fetch("DUMMY_PATH", nil)]) do |t|
|
66
66
|
# Ref: https://circleci.com/docs/2.0/configuration-reference#store_test_results
|
67
67
|
# Ref: https://github.com/solidusio/circleci-orbs-extensions#test-results-rspec
|
68
|
-
if ENV[
|
68
|
+
if ENV["TEST_RESULTS_PATH"]
|
69
69
|
t.rspec_opts =
|
70
70
|
"--format progress " \
|
71
|
-
"--format RspecJunitFormatter --out #{ENV[
|
71
|
+
"--format RspecJunitFormatter --out #{ENV["TEST_RESULTS_PATH"]}"
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
def install_changelog_task
|
78
|
-
require
|
78
|
+
require "github_changelog_generator/task"
|
79
79
|
|
80
80
|
GitHubChangelogGenerator::RakeTask.new(:changelog) do |config|
|
81
|
-
require
|
82
|
-
repo = Octokit::Repository.from_url(gemspec.metadata[
|
81
|
+
require "octokit"
|
82
|
+
repo = Octokit::Repository.from_url(gemspec.metadata["source_code_uri"] || gemspec.homepage)
|
83
83
|
|
84
84
|
config.user = repo.owner
|
85
85
|
config.project = repo.name
|
86
|
-
config.future_release = "v#{ENV.fetch(
|
86
|
+
config.future_release = "v#{ENV.fetch("UNRELEASED_VERSION") { gemspec.version }}"
|
87
87
|
rescue Octokit::InvalidRepository
|
88
88
|
warn <<~WARN
|
89
89
|
It won't be possible to automatically generate the CHANGELOG for this extension because the
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Allow to override the initial windows size
|
4
|
-
CAPYBARA_WINDOW_SIZE = ENV.fetch(
|
4
|
+
CAPYBARA_WINDOW_SIZE = ENV.fetch("CAPYBARA_WINDOW_SIZE", "1920x1080").split("x", 2).map(&:to_i)
|
5
5
|
CAPYBARA_WINDOW_WIDTH = CAPYBARA_WINDOW_SIZE[0]
|
6
6
|
CAPYBARA_WINDOW_HEIGHT = CAPYBARA_WINDOW_SIZE[1]
|
7
7
|
|
8
|
-
Capybara.javascript_driver = ENV.fetch(
|
8
|
+
Capybara.javascript_driver = ENV.fetch("CAPYBARA_JAVASCRIPT_DRIVER", "solidus_chrome_headless").to_sym
|
9
9
|
Capybara.default_max_wait_time = 10
|
10
|
-
Capybara.server = :puma, {
|
10
|
+
Capybara.server = :puma, {Silent: true} # A fix for rspec/rspec-rails#1897
|
11
11
|
|
12
12
|
Capybara.drivers[:selenium_chrome_headless].tap do |original_driver|
|
13
13
|
Capybara.register_driver :solidus_chrome_headless do |app|
|
@@ -19,10 +19,10 @@ Capybara.drivers[:selenium_chrome_headless].tap do |original_driver|
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
require
|
22
|
+
require "capybara-screenshot/rspec"
|
23
23
|
|
24
24
|
Capybara::Screenshot.register_driver(:solidus_chrome_headless) do |driver, path|
|
25
25
|
driver.browser.save_screenshot(path)
|
26
26
|
end
|
27
27
|
|
28
|
-
require
|
28
|
+
require "spree/testing_support/capybara_ext"
|
@@ -9,16 +9,24 @@
|
|
9
9
|
# Note that things may not work properly if you don't include this at the very top!
|
10
10
|
#
|
11
11
|
|
12
|
-
require
|
13
|
-
SimpleCov.start(
|
12
|
+
require "simplecov"
|
13
|
+
SimpleCov.start("rails") do
|
14
14
|
add_filter %r{^/lib/generators/.*/install/install_generator.rb}
|
15
15
|
add_filter %r{^/lib/.*/factories.rb}
|
16
16
|
add_filter %r{^/lib/.*/version.rb}
|
17
17
|
end
|
18
18
|
|
19
|
-
if ENV[
|
20
|
-
require
|
19
|
+
if ENV["CODECOV_TOKEN"]
|
20
|
+
require "codecov"
|
21
21
|
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
22
|
+
warn <<~WARN
|
23
|
+
DEPRECATION WARNING: The Codecov ruby uploader is deprecated.
|
24
|
+
Please use the Codecov CLI uploader to upload code coverage reports.
|
25
|
+
See https://docs.codecov.com/docs/deprecated-uploader-migration-guide#ruby-uploader for more information on upgrading.
|
26
|
+
WARN
|
27
|
+
elsif ENV["CODECOV_COVERAGE_PATH"]
|
28
|
+
require "simplecov-cobertura"
|
29
|
+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
22
30
|
else
|
23
|
-
warn "Provide a
|
31
|
+
warn "Provide a CODECOV_COVERAGE_PATH environment variable to enable Codecov uploads"
|
24
32
|
end
|
@@ -7,8 +7,8 @@
|
|
7
7
|
# require 'solidus_dev_support/rspec/feature_helper'
|
8
8
|
#
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
10
|
+
require "solidus_dev_support/rspec/rails_helper"
|
11
|
+
require "solidus_dev_support/rspec/capybara"
|
12
12
|
|
13
13
|
dev_support_assets_preload = ->(*) {
|
14
14
|
if Rails.application.respond_to?(:precompiled_assets)
|
@@ -7,20 +7,20 @@
|
|
7
7
|
# require 'solidus_dev_support/rspec/rails_helper'
|
8
8
|
#
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
10
|
+
require "solidus_dev_support/rspec/spec_helper"
|
11
|
+
require "solidus_dev_support"
|
12
12
|
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
13
|
+
require "rspec/rails"
|
14
|
+
require "database_cleaner"
|
15
|
+
require "factory_bot"
|
16
|
+
require "ffaker"
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
18
|
+
require "spree/testing_support/authorization_helpers"
|
19
|
+
require "spree/testing_support/url_helpers"
|
20
|
+
require "spree/testing_support/preferences"
|
21
|
+
require "spree/testing_support/controller_requests"
|
22
|
+
require "solidus_dev_support/testing_support/factories"
|
23
|
+
require "solidus_dev_support/testing_support/preferences"
|
24
24
|
|
25
25
|
RSpec.configure do |config|
|
26
26
|
config.infer_spec_type_from_file_location!
|
@@ -66,8 +66,8 @@ RSpec.configure do |config|
|
|
66
66
|
class ZeitwerkNameError < NameError; end
|
67
67
|
|
68
68
|
error_message =
|
69
|
-
if
|
70
|
-
e.message.sub(/expected file #{Regexp.escape(File.expand_path(
|
69
|
+
if /expected file .*? to define constant [\w:]+/.match?(e.message)
|
70
|
+
e.message.sub(/expected file #{Regexp.escape(File.expand_path("../..", Rails.root))}./, "expected file ")
|
71
71
|
else
|
72
72
|
e.message
|
73
73
|
end
|
@@ -14,8 +14,8 @@ RSpec.configure do |config|
|
|
14
14
|
config.mock_with :rspec
|
15
15
|
config.color = true
|
16
16
|
|
17
|
-
config.fail_fast = ENV.fetch(
|
18
|
-
config.order =
|
17
|
+
config.fail_fast = ENV.fetch("FAIL_FAST", false)
|
18
|
+
config.order = "random"
|
19
19
|
|
20
20
|
config.raise_errors_for_deprecations!
|
21
21
|
|