Skip to content

Commit

Permalink
Add an "admin/" folder to house the new solidus_admin gem
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed May 4, 2023
1 parent afa58b4 commit d6f84a5
Show file tree
Hide file tree
Showing 11 changed files with 201 additions and 0 deletions.
7 changes: 7 additions & 0 deletions admin/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright © 2023 Solidus Team

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 4 additions & 0 deletions admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# solidus_admin (WIP)

A Rails engine that provides a backend administration interface to the Solidus ecommerce platform.

17 changes: 17 additions & 0 deletions admin/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'spree/testing_support/dummy_app/rake_tasks'

RSpec::Core::RakeTask.new
task default: :spec

DummyApp::RakeTasks.new(
gem_root: File.expand_path(__dir__),
lib_name: 'solidus_admin'
)

task test_app: 'db:reset'
Empty file.
Empty file.
4 changes: 4 additions & 0 deletions admin/config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

SolidusAdmin::Engine.routes.draw do
end
4 changes: 4 additions & 0 deletions admin/lib/solidus_admin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

require 'solidus_admin/version'
require 'solidus_admin/engine'
6 changes: 6 additions & 0 deletions admin/lib/solidus_admin/engine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

module SolidusAdmin
class Engine < ::Rails::Engine
end
end
7 changes: 7 additions & 0 deletions admin/lib/solidus_admin/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

require 'spree/core/version'

module SolidusAdmin
VERSION = Spree.solidus_version
end
27 changes: 27 additions & 0 deletions admin/solidus_admin.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require_relative '../core/lib/spree/core/version.rb'

Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'solidus_admin'
s.version = Spree.solidus_version
s.summary = 'Admin interface for the Solidus e-commerce framework.'
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
end
125 changes: 125 additions & 0 deletions admin/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# frozen_string_literal: true

if ENV["COVERAGE"]
require 'simplecov'
if ENV["COVERAGE_DIR"]
SimpleCov.coverage_dir(ENV["COVERAGE_DIR"])
end
SimpleCov.command_name('solidus:admin')
SimpleCov.merge_timeout(3600)
SimpleCov.start('rails')
end

# This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'

require 'solidus_admin'
require 'spree/testing_support/dummy_app'
DummyApp.setup(
gem_root: File.expand_path('..', __dir__),
lib_name: 'solidus_admin'
)

require 'rails-controller-testing'
require 'rspec-activemodel-mocks'
require 'rspec/rails'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

require 'database_cleaner'

require 'spree/testing_support/factory_bot'
require 'spree/testing_support/partial_double_verification'
require 'spree/testing_support/authorization_helpers'
require 'spree/testing_support/preferences'
require 'spree/testing_support/controller_requests'
require 'spree/testing_support/flaky'
require 'spree/testing_support/flash'
require 'spree/testing_support/url_helpers'
require 'spree/testing_support/order_walkthrough'
require 'spree/testing_support/capybara_ext'
require 'spree/testing_support/precompiled_assets'
require 'spree/testing_support/translations'
require 'spree/testing_support/job_helpers'
require 'spree/testing_support/blacklist_urls'

require 'capybara-screenshot/rspec'
Capybara.save_path = ENV['CIRCLE_ARTIFACTS'] if ENV['CIRCLE_ARTIFACTS']
Capybara.exact = true

require "selenium/webdriver"
require 'webdrivers'

Capybara.register_driver :selenium_chrome_headless do |app|
browser_options = ::Selenium::WebDriver::Chrome::Options.new
browser_options.args << '--headless'
browser_options.args << '--disable-gpu'
browser_options.args << '--window-size=1920,1080'
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end
Capybara.register_driver :selenium_chrome_headless_docker_friendly do |app|
browser_options = ::Selenium::WebDriver::Chrome::Options.new
browser_options.args << '--headless'
browser_options.args << '--disable-gpu'
# Sandbox cannot be used inside unprivileged Docker container
browser_options.args << '--no-sandbox'
browser_options.args << '--window-size=1240,1400'
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
end

Capybara.javascript_driver = (ENV['CAPYBARA_DRIVER'] || :selenium_chrome_headless).to_sym

Rails.application.config.i18n.raise_on_missing_translations = true

Capybara.default_max_wait_time = ENV['DEFAULT_MAX_WAIT_TIME'].to_f if ENV['DEFAULT_MAX_WAIT_TIME'].present?

ActiveJob::Base.queue_adapter = :test

Spree::TestingSupport::FactoryBot.add_paths_and_load!

RSpec.configure do |config|
config.color = true
config.infer_spec_type_from_file_location!
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.mock_with :rspec do |c|
c.syntax = :expect
end

# 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.fixture_path = "spec/fixtures"

config.before :suite do
DatabaseCleaner.clean_with :truncation
end

config.before do
Rails.cache.clear
end

config.include BaseFeatureHelper, type: :feature
config.include BaseFeatureHelper, type: :system

config.include FactoryBot::Syntax::Methods

config.include Spree::TestingSupport::Preferences
config.include Spree::TestingSupport::UrlHelpers
config.include Spree::TestingSupport::ControllerRequests, type: :controller
config.include Spree::TestingSupport::Flash
config.include Spree::TestingSupport::Translations
config.include Spree::TestingSupport::JobHelpers
config.include Spree::TestingSupport::BlacklistUrls

config.example_status_persistence_file_path = "./spec/examples.txt"

config.order = :random

Kernel.srand config.seed
end

0 comments on commit d6f84a5

Please sign in to comment.