-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5678 from mamhoff/legacy-promotions-gem
Add Legacy promotions gem
- Loading branch information
Showing
12 changed files
with
216 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rubygems' | ||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rspec/core/rake_task' | ||
require 'spree/testing_support/dummy_app/rake_tasks' | ||
require 'bundler/gem_tasks' | ||
|
||
RSpec::Core::RakeTask.new | ||
task default: :spec | ||
|
||
DummyApp::RakeTasks.new( | ||
gem_root: File.dirname(__FILE__), | ||
lib_name: 'solidus_legacy_promotions' | ||
) | ||
|
||
require 'yard/rake/yardoc_task' | ||
YARD::Rake::YardocTask.new(:yard) | ||
# The following workaround can be removed | ||
# once https://github.com/lsegal/yard/pull/1457 is merged. | ||
task('yard:require') { require 'yard' } | ||
task yard: 'yard:require' | ||
|
||
namespace :spec do | ||
task :isolated do | ||
spec_files = Dir['spec/**/*_spec.rb'] | ||
failed_specs = | ||
spec_files.reject do |file| | ||
puts "rspec #{file}" | ||
system('rspec', file) | ||
end | ||
|
||
if !failed_specs.empty? | ||
puts "Failed specs:" | ||
puts failed_specs | ||
exit 1 | ||
end | ||
end | ||
end | ||
|
||
task test_app: 'db:reset' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env ruby | ||
# This command will automatically be run when you run "rails" with Rails gems | ||
# installed from the root of your application. | ||
|
||
ENGINE_ROOT = File.expand_path('..', __dir__) | ||
ENGINE_PATH = File.expand_path('../lib/spree/core/engine', __dir__) | ||
|
||
# Set up gems listed in the Gemfile. | ||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __dir__) | ||
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) | ||
|
||
require "rails/all" | ||
require "rails/engine/commands" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
require "solidus_core" | ||
require "solidus_support" | ||
|
||
module SolidusLegacyPromotions | ||
VERSION = Spree.solidus_version | ||
end | ||
|
||
require "solidus_legacy_promotions/engine" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
module SolidusLegacyPromotions | ||
class Engine < ::Rails::Engine | ||
include SolidusSupport::EngineExtensions | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../core/lib/spree/core/version' | ||
|
||
Gem::Specification.new do |s| | ||
s.platform = Gem::Platform::RUBY | ||
s.name = 'solidus_legacy_promotions' | ||
s.version = Spree.solidus_version | ||
s.summary = 'Legacy Solidus promotion system' | ||
s.description = s.summary | ||
|
||
s.author = 'Solidus Team' | ||
s.email = 'contact@solidus.io' | ||
s.homepage = 'http://solidus.io' | ||
s.license = 'BSD-3-Clause' | ||
|
||
s.metadata['rubygems_mfa_required'] = 'true' | ||
|
||
s.files = `git ls-files -z`.split("\x0").reject do |f| | ||
f.match(%r{^(spec|script)/}) | ||
end | ||
|
||
s.required_ruby_version = '>= 3.0.0' | ||
s.required_rubygems_version = '>= 1.8.23' | ||
|
||
s.add_dependency 'solidus_core', s.version | ||
s.add_dependency 'solidus_support' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
RSpec.describe SolidusLegacyPromotions do | ||
it "has a version number" do | ||
expect(SolidusLegacyPromotions::VERSION).not_to be nil | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
ENV["RAILS_ENV"] ||= 'test' | ||
|
||
require 'spree/testing_support/dummy_app' | ||
DummyApp.setup( | ||
gem_root: File.expand_path('..', __dir__), | ||
lib_name: 'solidus_legacy_promotions' | ||
) | ||
|
||
require 'rspec/rails' | ||
require 'rspec-activemodel-mocks' | ||
require 'database_cleaner' | ||
|
||
Dir["./spec/support/**/*.rb"].sort.each { |f| require f } | ||
|
||
require 'spree/testing_support/factory_bot' | ||
require 'spree/testing_support/preferences' | ||
require 'spree/testing_support/rake' | ||
require 'spree/testing_support/job_helpers' | ||
require 'cancan/matchers' | ||
|
||
ActiveJob::Base.queue_adapter = :test | ||
|
||
Spree::TestingSupport::FactoryBot.add_paths_and_load! | ||
|
||
RSpec.configure do |config| | ||
config.fixture_path = File.join(__dir__, "fixtures") | ||
|
||
config.infer_spec_type_from_file_location! | ||
|
||
# If you're not using ActiveRecord, or you'd prefer not to run each of your | ||
# examples within a transaction, comment the following line or assign false | ||
# instead of true. | ||
config.use_transactional_fixtures = true | ||
|
||
config.before :suite do | ||
FileUtils.rm_rf(Rails.configuration.active_storage.service_configurations[:test][:root]) unless ENV['DISABLE_ACTIVE_STORAGE'] == 'true' | ||
DatabaseCleaner.clean_with :truncation | ||
end | ||
|
||
config.before :each do | ||
Rails.cache.clear | ||
end | ||
|
||
config.include Spree::TestingSupport::JobHelpers | ||
|
||
config.include FactoryBot::Syntax::Methods | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# frozen_string_literal: true | ||
|
||
if ENV["COVERAGE"] | ||
require 'simplecov' | ||
if ENV["COVERAGE_DIR"] | ||
SimpleCov.coverage_dir(ENV["COVERAGE_DIR"]) | ||
end | ||
SimpleCov.command_name('solidus:core') | ||
SimpleCov.merge_timeout(3600) | ||
SimpleCov.start('rails') | ||
end | ||
|
||
require 'rspec/core' | ||
|
||
require 'spree/testing_support/flaky' | ||
require 'spree/testing_support/partial_double_verification' | ||
require 'spree/testing_support/silence_deprecations' | ||
require 'spree/testing_support/preferences' | ||
require 'spree/deprecator' | ||
require 'spree/config' | ||
|
||
require "solidus_legacy_promotions" | ||
|
||
RSpec.configure do |config| | ||
config.disable_monkey_patching! | ||
config.color = true | ||
config.expect_with :rspec do |c| | ||
c.syntax = :expect | ||
end | ||
config.mock_with :rspec do |c| | ||
c.syntax = :expect | ||
end | ||
|
||
config.include Spree::TestingSupport::Preferences | ||
|
||
config.filter_run focus: true | ||
config.run_all_when_everything_filtered = true | ||
|
||
config.example_status_persistence_file_path = "./spec/examples.txt" | ||
|
||
config.order = :random | ||
|
||
Kernel.srand config.seed | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters