solidus_dev_support 1.5.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +10 -17
- data/.mergify.yml +2 -0
- data/.rubocop.yml +42 -0
- data/CHANGELOG.md +72 -0
- data/Gemfile +1 -1
- data/README.md +13 -4
- data/Rakefile +13 -1
- data/lib/solidus_dev_support/extension.rb +32 -23
- data/lib/solidus_dev_support/rake_tasks.rb +14 -0
- data/lib/solidus_dev_support/rspec/capybara.rb +20 -0
- data/lib/solidus_dev_support/rspec/feature_helper.rb +17 -18
- data/lib/solidus_dev_support/rspec/rails_helper.rb +8 -5
- data/lib/solidus_dev_support/rubocop/config.yml +82 -203
- data/lib/solidus_dev_support/solidus_command.rb +8 -1
- data/lib/solidus_dev_support/templates/extension/.circleci/config.yml +6 -0
- data/lib/solidus_dev_support/templates/extension/.github/stale.yml +4 -4
- data/lib/solidus_dev_support/templates/extension/CHANGELOG.md +1 -0
- data/lib/solidus_dev_support/templates/extension/README.md +18 -10
- data/lib/solidus_dev_support/templates/extension/bin/rails-sandbox +1 -1
- data/lib/solidus_dev_support/templates/extension/bin/sandbox.tt +2 -0
- data/lib/solidus_dev_support/templates/extension/extension.gemspec.tt +4 -4
- data/lib/solidus_dev_support/templates/extension/github_changelog_generator +2 -0
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%.rb.tt +1 -0
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%/configuration.rb.tt +21 -0
- data/lib/solidus_dev_support/templates/extension/lib/%file_name%/{factories.rb.tt → testing_support/factories.rb.tt} +0 -0
- data/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +10 -5
- data/lib/solidus_dev_support/templates/extension/lib/generators/%file_name%/install/templates/initializer.rb.tt +6 -0
- data/lib/solidus_dev_support/templates/extension/rubocop.yml +3 -0
- data/lib/solidus_dev_support/templates/extension/spec/spec_helper.rb.tt +11 -7
- data/lib/solidus_dev_support/version.rb +5 -1
- data/solidus_dev_support.gemspec +16 -14
- data/spec/features/create_extension_spec.rb +187 -0
- data/spec/lib/extension_spec.rb +69 -0
- data/spec/spec_helper.rb +16 -0
- metadata +47 -35
@@ -72,9 +72,11 @@ unbundled bundle exec rails generate spree:install \
|
|
72
72
|
--user_class=Spree::User \
|
73
73
|
--enforce_available_locales=true \
|
74
74
|
--with-authentication=false \
|
75
|
+
--payment-method=none \
|
75
76
|
$@
|
76
77
|
|
77
78
|
unbundled bundle exec rails generate solidus:auth:install
|
79
|
+
unbundled bundle exec rails generate ${extension_name}:install
|
78
80
|
|
79
81
|
echo
|
80
82
|
echo "🚀 Sandbox app successfully created for $extension_name!"
|
@@ -9,12 +9,12 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = '<%= gemspec.email %>'
|
10
10
|
|
11
11
|
spec.summary = '<%= gemspec.summary %>'
|
12
|
-
spec.description = '<%= gemspec.description %>'
|
13
|
-
spec.homepage = '<%= gemspec.homepage %>'
|
12
|
+
<% if gemspec.description %>spec.description = '<%= gemspec.description %>'
|
13
|
+
<% end %>spec.homepage = '<%= gemspec.homepage %>'
|
14
14
|
spec.license = '<%= gemspec.license %>'
|
15
15
|
|
16
16
|
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
-
spec.metadata['source_code_uri'] = '<%= gemspec.
|
17
|
+
spec.metadata['source_code_uri'] = '<%= gemspec.metadata["source_code_uri"] %>'
|
18
18
|
spec.metadata['changelog_uri'] = '<%= gemspec.metadata["changelog_uri"] %>'
|
19
19
|
|
20
20
|
spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
|
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 3']
|
33
33
|
spec.add_dependency 'solidus_support', '~> 0.5'
|
34
34
|
|
35
|
-
spec.add_development_dependency 'solidus_dev_support'
|
35
|
+
spec.add_development_dependency 'solidus_dev_support', '<%= SolidusDevSupport.gem_version.approximate_recommendation %>'
|
36
36
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module <%= class_name %>
|
4
|
+
class Configuration
|
5
|
+
# Define here the settings for this extensions, e.g.:
|
6
|
+
#
|
7
|
+
# attr_accessor :my_setting
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def configuration
|
12
|
+
@configuration ||= Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
alias config configuration
|
16
|
+
|
17
|
+
def configure
|
18
|
+
yield configuration
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
File without changes
|
@@ -4,15 +4,20 @@ module <%= class_name %>
|
|
4
4
|
module Generators
|
5
5
|
class InstallGenerator < Rails::Generators::Base
|
6
6
|
class_option :auto_run_migrations, type: :boolean, default: false
|
7
|
+
source_root File.expand_path('templates', __dir__)
|
8
|
+
|
9
|
+
def copy_initializer
|
10
|
+
template 'initializer.rb', 'config/initializers/<%= file_name %>.rb'
|
11
|
+
end
|
7
12
|
|
8
13
|
def add_javascripts
|
9
|
-
append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/<%= file_name %>\n"
|
10
|
-
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/<%= file_name %>\n"
|
14
|
+
append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/<%= file_name %>\n"
|
15
|
+
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/<%= file_name %>\n"
|
11
16
|
end
|
12
17
|
|
13
18
|
def add_stylesheets
|
14
|
-
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable
|
15
|
-
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable
|
19
|
+
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
|
20
|
+
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
|
16
21
|
end
|
17
22
|
|
18
23
|
def add_migrations
|
@@ -20,7 +25,7 @@ module <%= class_name %>
|
|
20
25
|
end
|
21
26
|
|
22
27
|
def run_migrations
|
23
|
-
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable
|
28
|
+
run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
|
24
29
|
if run_migrations
|
25
30
|
run 'bin/rails db:migrate'
|
26
31
|
else
|
@@ -6,22 +6,26 @@ ENV['RAILS_ENV'] = 'test'
|
|
6
6
|
# Run Coverage report
|
7
7
|
require 'solidus_dev_support/rspec/coverage'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
# Create the dummy app if it's still missing.
|
10
|
+
dummy_env = "#{__dir__}/dummy/config/environment.rb"
|
11
|
+
system 'bin/rake extension:test_app' unless File.exist? dummy_env
|
12
|
+
require dummy_env
|
13
13
|
|
14
14
|
# Requires factories and other useful helpers defined in spree_core.
|
15
15
|
require 'solidus_dev_support/rspec/feature_helper'
|
16
16
|
|
17
17
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
18
18
|
# in spec/support/ and its subdirectories.
|
19
|
-
Dir[
|
19
|
+
Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f }
|
20
20
|
|
21
|
-
# Requires factories defined in lib/<%= file_name %>/factories.rb
|
22
|
-
require '<%= file_name %>/factories'
|
21
|
+
# Requires factories defined in lib/<%= file_name %>/testing_support/factories.rb
|
22
|
+
require '<%= file_name %>/testing_support/factories'
|
23
23
|
|
24
24
|
RSpec.configure do |config|
|
25
25
|
config.infer_spec_type_from_file_location!
|
26
26
|
config.use_transactional_fixtures = false
|
27
|
+
|
28
|
+
if Spree.solidus_gem_version < Gem::Version.new('2.11')
|
29
|
+
config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :system
|
30
|
+
end
|
27
31
|
end
|
data/solidus_dev_support.gemspec
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'solidus_dev_support/version'
|
3
|
+
require_relative 'lib/solidus_dev_support/version'
|
6
4
|
|
7
5
|
Gem::Specification.new do |spec|
|
8
6
|
spec.name = 'solidus_dev_support'
|
@@ -16,33 +14,37 @@ Gem::Specification.new do |spec|
|
|
16
14
|
|
17
15
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
16
|
spec.metadata['source_code_uri'] = 'https://github.com/solidusio/solidus_dev_support'
|
17
|
+
spec.metadata['changelog_uri'] = 'https://github.com/solidusio/solidus_dev_support/blob/master/CHANGELOG.md'
|
18
|
+
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new('~> 2.5')
|
19
20
|
|
20
21
|
# Specify which files should be added to the gem when it is released.
|
21
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
spec.
|
26
|
-
spec.
|
27
|
-
spec.
|
28
|
-
|
29
|
-
|
23
|
+
files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
|
24
|
+
|
25
|
+
spec.files = files.grep_v(%r{^(test|spec|features)/})
|
26
|
+
spec.test_files = files.grep(%r{^(test|spec|features)/})
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
30
31
|
spec.add_dependency 'capybara', '~> 3.29'
|
31
32
|
spec.add_dependency 'capybara-screenshot', '~> 1.0'
|
32
|
-
spec.add_dependency 'codecov', '~> 0.
|
33
|
+
spec.add_dependency 'codecov', '~> 0.2'
|
33
34
|
spec.add_dependency 'database_cleaner', '~> 1.7'
|
34
35
|
spec.add_dependency 'factory_bot_rails', '~> 5.1'
|
35
36
|
spec.add_dependency 'ffaker', '~> 2.13'
|
36
37
|
spec.add_dependency 'gem-release', '~> 2.1'
|
37
38
|
spec.add_dependency 'github_changelog_generator', '~> 1.15'
|
38
39
|
spec.add_dependency 'puma', '~> 4.3'
|
39
|
-
spec.add_dependency 'rspec-rails', '~> 4.0.0.beta3'
|
40
40
|
spec.add_dependency 'rspec_junit_formatter'
|
41
|
-
spec.add_dependency '
|
41
|
+
spec.add_dependency 'rspec-rails', '~> 4.0.0.beta3'
|
42
|
+
spec.add_dependency 'rubocop', '~> 1.0'
|
42
43
|
spec.add_dependency 'rubocop-performance', '~> 1.5'
|
43
44
|
spec.add_dependency 'rubocop-rails', '~> 2.3'
|
44
45
|
spec.add_dependency 'rubocop-rspec', '~> 1.36'
|
45
46
|
spec.add_dependency 'solidus_core', ['>= 2.0', '< 3']
|
47
|
+
spec.add_dependency 'webdrivers', '~> 4.4'
|
46
48
|
|
47
49
|
spec.add_development_dependency 'bundler'
|
48
50
|
spec.add_development_dependency 'rake'
|
@@ -0,0 +1,187 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'open3'
|
5
|
+
require 'spec_helper'
|
6
|
+
require 'spree/core/version'
|
7
|
+
|
8
|
+
RSpec.describe 'Create extension' do
|
9
|
+
include FileUtils
|
10
|
+
|
11
|
+
let(:gem_root) { File.expand_path('../..', __dir__) }
|
12
|
+
let(:solidus_cmd) { "#{gem_root}/exe/solidus" }
|
13
|
+
let(:extension_name) { 'test_extension' }
|
14
|
+
let(:gemspec_name) { "solidus_#{extension_name}.gemspec" }
|
15
|
+
let(:tmp_path) { Pathname.new(gem_root).join('tmp') }
|
16
|
+
let(:install_path) { tmp_path.join("solidus_#{extension_name}") }
|
17
|
+
let(:command_failed_error) { Class.new(StandardError) }
|
18
|
+
|
19
|
+
before do
|
20
|
+
rm_rf(install_path)
|
21
|
+
mkdir_p(tmp_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
def step(method_name)
|
25
|
+
puts "Step #{method_name}"
|
26
|
+
send method_name
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'checks the create extension process' do
|
30
|
+
step :check_solidus_cmd
|
31
|
+
step :check_gem_version
|
32
|
+
step :check_create_extension
|
33
|
+
step :check_bundle_install
|
34
|
+
step :check_default_task
|
35
|
+
step :check_run_specs
|
36
|
+
step :check_sandbox
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def check_solidus_cmd
|
42
|
+
cd(tmp_path) do
|
43
|
+
output = `#{solidus_cmd} -h`
|
44
|
+
expect($?).to be_success
|
45
|
+
expect(output).to include('Commands:')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def check_gem_version
|
50
|
+
gem_version_commands = ['version', '--version', '-v']
|
51
|
+
gem_version = SolidusDevSupport::VERSION
|
52
|
+
solidus_version = Spree.solidus_gem_version
|
53
|
+
|
54
|
+
cd(tmp_path) do
|
55
|
+
gem_version_commands.each do |gem_version_cmd|
|
56
|
+
output = `#{solidus_cmd} #{gem_version_cmd}`
|
57
|
+
expect($?).to be_success
|
58
|
+
expect(output).to include("Solidus version #{solidus_version}")
|
59
|
+
expect(output).to include("Solidus Dev Support version #{gem_version}")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def check_create_extension
|
65
|
+
cd(tmp_path) do
|
66
|
+
output = `#{solidus_cmd} extension #{extension_name}`
|
67
|
+
expect($?).to be_success
|
68
|
+
expect(output).to include(gemspec_name)
|
69
|
+
expect(output).to include('.circleci')
|
70
|
+
end
|
71
|
+
|
72
|
+
cd(install_path) do
|
73
|
+
aggregate_failures do
|
74
|
+
%w[
|
75
|
+
bin/console
|
76
|
+
bin/rails
|
77
|
+
bin/rails-engine
|
78
|
+
bin/rails-sandbox
|
79
|
+
bin/sandbox
|
80
|
+
bin/setup
|
81
|
+
].each do |bin|
|
82
|
+
bin = Pathname(bin)
|
83
|
+
expect(
|
84
|
+
name: bin,
|
85
|
+
exist: bin.exist?,
|
86
|
+
executable: bin.stat.executable?
|
87
|
+
).to eq(
|
88
|
+
name: bin,
|
89
|
+
exist: true,
|
90
|
+
executable: true
|
91
|
+
)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def check_bundle_install
|
98
|
+
cd(install_path) do
|
99
|
+
open('Gemfile', 'a') { |f| f.puts "gem 'solidus_dev_support', path: '../../..'" }
|
100
|
+
end
|
101
|
+
|
102
|
+
expect { bundle_install }.to raise_error(command_failed_error, /invalid gemspec/)
|
103
|
+
|
104
|
+
# Update gemspec with the required fields
|
105
|
+
gemspec_path = install_path.join(gemspec_name)
|
106
|
+
gemspec = gemspec_path.read.lines
|
107
|
+
gemspec.grep(/spec\.author/).first.replace(" spec.author = 'John Doe'\n")
|
108
|
+
gemspec.grep(/spec\.email/).first.replace(" spec.email = 'john@example.com'\n")
|
109
|
+
gemspec.grep(/spec\.summary/).first.replace(" spec.summary = 'A nice extension'\n")
|
110
|
+
gemspec.grep(/spec\.description/).first.replace(" spec.description = 'A super nice extension'\n")
|
111
|
+
gemspec_path.write(gemspec.join)
|
112
|
+
|
113
|
+
expect(bundle_install).to match(/Bundle complete/)
|
114
|
+
end
|
115
|
+
|
116
|
+
def check_default_task
|
117
|
+
cd(install_path) do
|
118
|
+
output = sh('bin/rake')
|
119
|
+
expect(output).to include('Generating dummy Rails application')
|
120
|
+
expect(output).to include('0 examples, 0 failures')
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def check_run_specs
|
125
|
+
install_path.join('spec', 'some_spec.rb').write(
|
126
|
+
"require 'spec_helper'\nRSpec.describe 'Some test' do it { expect(true).to be_truthy } end\n"
|
127
|
+
)
|
128
|
+
cd(install_path) do
|
129
|
+
output = sh('bundle exec rspec')
|
130
|
+
expect(output).to include('1 example, 0 failures')
|
131
|
+
expect(output).to include(ENV['CODECOV_TOKEN'] ? 'Coverage reports upload successfully' : 'Provide a CODECOV_TOKEN environment variable to enable Codecov uploads')
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def check_sandbox
|
136
|
+
cd(install_path) do
|
137
|
+
# rubocop:disable Lint/InterpolationCheck
|
138
|
+
command = 'bin/rails-sandbox runner "puts %{The version of SolidusTestExtension is #{SolidusTestExtension::VERSION}}"'
|
139
|
+
# rubocop:enable Lint/InterpolationCheck
|
140
|
+
|
141
|
+
first_run_output = sh(command)
|
142
|
+
expect(first_run_output).to include("Creating the sandbox app...")
|
143
|
+
expect(first_run_output).to include('The version of SolidusTestExtension is 0.0.1')
|
144
|
+
|
145
|
+
second_run_output = sh(command)
|
146
|
+
expect(second_run_output).not_to include("Creating the sandbox app...")
|
147
|
+
expect(second_run_output).to include('The version of SolidusTestExtension is 0.0.1')
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
def sh(*args)
|
152
|
+
command = args.size == 1 ? args.first : args.shelljoin
|
153
|
+
output, status = with_unbundled_env { Open3.capture2e(command) }
|
154
|
+
|
155
|
+
if status.success?
|
156
|
+
output.to_s
|
157
|
+
else
|
158
|
+
if $DEBUG
|
159
|
+
warn '~' * 80
|
160
|
+
warn "$ #{command}"
|
161
|
+
warn output.to_s
|
162
|
+
end
|
163
|
+
raise(command_failed_error, "command failed: #{command}\n#{output}")
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def with_unbundled_env(&block)
|
168
|
+
if Bundler.respond_to?(:with_unbundled_env)
|
169
|
+
Bundler.with_unbundled_env(&block)
|
170
|
+
else
|
171
|
+
Bundler.with_clean_env(&block)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def bundle_install
|
176
|
+
# Optimize the bundle path within the CI, in this context using bundler env
|
177
|
+
# variables doesn't help because commands are run with a clean env.
|
178
|
+
bundle_path = "#{gem_root}/vendor/bundle"
|
179
|
+
|
180
|
+
command = 'bundle install'
|
181
|
+
command += " --path=#{bundle_path.shellescape}" if File.exist?(bundle_path)
|
182
|
+
|
183
|
+
output = nil
|
184
|
+
cd(install_path) { output = sh command }
|
185
|
+
output
|
186
|
+
end
|
187
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'solidus_dev_support/extension'
|
2
|
+
|
3
|
+
RSpec.describe SolidusDevSupport::Extension do
|
4
|
+
describe '#path=' do
|
5
|
+
specify 'with an existing extension' do
|
6
|
+
allow(subject).to receive(:git).with('remote get-url origin', any_args).and_return('git@github.com:some_user/solidus_my_ext.git')
|
7
|
+
allow(subject).to receive(:git).with('config user.name', any_args).and_return('John Doe')
|
8
|
+
allow(subject).to receive(:git).with('config user.email', any_args).and_return('john.doe@example.com')
|
9
|
+
|
10
|
+
allow(File).to receive(:exist?).with('/foo/bar/solidus_my_ext/solidus_my_ext.gemspec').and_return(true)
|
11
|
+
allow(Gem::Specification).to receive(:load).with('/foo/bar/solidus_my_ext/solidus_my_ext.gemspec').and_return(
|
12
|
+
Gem::Specification.new('solidus_my_ext', '0.1.1') do |gem|
|
13
|
+
gem.author = "Jane Doe"
|
14
|
+
gem.email = "jane.doe@example.com"
|
15
|
+
|
16
|
+
gem.summary = 'This extension is awesome!'
|
17
|
+
gem.license = 'MIT'
|
18
|
+
|
19
|
+
gem.homepage = "some_user.github.io/solidus_my_ext"
|
20
|
+
gem.metadata['changelog_uri'] = "https://github.com/some_user/solidus_my_ext/releases"
|
21
|
+
gem.metadata['source_code_uri'] = "https://github.com/some_user/solidus_my_ext"
|
22
|
+
end
|
23
|
+
)
|
24
|
+
|
25
|
+
subject.path = '/foo/bar/solidus_my_ext'
|
26
|
+
|
27
|
+
aggregate_failures do
|
28
|
+
expect(subject.file_name).to eq("solidus_my_ext")
|
29
|
+
expect(subject.class_name).to eq("SolidusMyExt")
|
30
|
+
expect(subject.root).to eq("/foo/bar")
|
31
|
+
expect(subject.path).to eq("/foo/bar/solidus_my_ext")
|
32
|
+
expect(subject.repo).to eq("some_user/solidus_my_ext")
|
33
|
+
expect(subject.gemspec.author).to eq('Jane Doe')
|
34
|
+
expect(subject.gemspec.email).to eq('jane.doe@example.com')
|
35
|
+
expect(subject.gemspec.summary).to eq('This extension is awesome!')
|
36
|
+
expect(subject.gemspec.license).to eq('MIT')
|
37
|
+
expect(subject.gemspec.homepage).to eq("some_user.github.io/solidus_my_ext")
|
38
|
+
expect(subject.gemspec.metadata['changelog_uri']).to eq("https://github.com/some_user/solidus_my_ext/releases")
|
39
|
+
expect(subject.gemspec.metadata['source_code_uri']).to eq("https://github.com/some_user/solidus_my_ext")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
specify 'when creating a new extension' do
|
44
|
+
allow(subject).to receive(:git).with('remote get-url origin', any_args) { |_, default| default }
|
45
|
+
allow(subject).to receive(:git).with('config user.name', any_args).and_return('John Doe')
|
46
|
+
allow(subject).to receive(:git).with('config user.email', any_args).and_return('john.doe@example.com')
|
47
|
+
|
48
|
+
allow(Dir).to receive(:pwd).and_return('/foo/bar')
|
49
|
+
|
50
|
+
subject.path = '/foo/bar/solidus_my_ext'
|
51
|
+
|
52
|
+
aggregate_failures do
|
53
|
+
expect(subject.file_name).to eq("solidus_my_ext")
|
54
|
+
expect(subject.class_name).to eq("SolidusMyExt")
|
55
|
+
expect(subject.root).to eq("/foo/bar")
|
56
|
+
expect(subject.path).to eq("/foo/bar/solidus_my_ext")
|
57
|
+
expect(subject.repo).to eq("solidusio-contrib/solidus_my_ext")
|
58
|
+
expect(subject.gemspec.author).to eq('John Doe')
|
59
|
+
expect(subject.gemspec.email).to eq('john.doe@example.com')
|
60
|
+
expect(subject.gemspec.summary).to eq('TODO: Write a short summary, because RubyGems requires one.')
|
61
|
+
expect(subject.gemspec.description).to eq('TODO: Write a longer description or delete this line.')
|
62
|
+
expect(subject.gemspec.license).to eq('BSD-3-Clause')
|
63
|
+
expect(subject.gemspec.homepage).to eq("https://github.com/solidusio-contrib/solidus_my_ext#readme")
|
64
|
+
expect(subject.gemspec.metadata['changelog_uri']).to eq("https://github.com/solidusio-contrib/solidus_my_ext/blob/master/CHANGELOG.md")
|
65
|
+
expect(subject.gemspec.metadata['source_code_uri']).to eq("https://github.com/solidusio-contrib/solidus_my_ext")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|