Skip to content

Commit

Permalink
Fix specs with the latest version of Solidus
Browse files Browse the repository at this point in the history
1. There's no more a frontend
2. Something changed in how images are saved and now they require access
   to the database, we can't use build_stubbed anymore in variant specs
3. some taxon/taxonomy validations was failing due to solidusio/solidus#4851
  • Loading branch information
kennyadsl committed May 2, 2023
1 parent df625b8 commit 0c7b216
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 23 deletions.
13 changes: 1 addition & 12 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@ source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
solidus_git, solidus_frontend_git = if (branch == 'master') || (branch >= 'v3.2')
%w[solidusio/solidus solidusio/solidus_frontend]
else
%w[solidusio/solidus] * 2
end
gem 'solidus', github: solidus_git, branch: branch
gem 'solidus_frontend', github: solidus_frontend_git, branch: branch

# Needed to help Bundler figure out how to resolve dependencies,
# otherwise it takes forever to resolve them.
# See https://github.com/bundler/bundler/issues/6677
gem 'rails', '>0.a'
gem 'solidus', github: 'solidusio/solidus', branch: branch

# Provides basic authentication functionality for testing parts of your engine
gem 'solidus_auth_devise'
Expand Down
2 changes: 0 additions & 2 deletions app/assets/javascripts/spree/frontend/solidus_importer.js

This file was deleted.

4 changes: 0 additions & 4 deletions app/assets/stylesheets/spree/frontend/solidus_importer.css

This file was deleted.

2 changes: 0 additions & 2 deletions lib/generators/solidus_importer/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ def copy_initializer
end

def add_javascripts
append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/solidus_importer\n"
append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/solidus_importer\n"
end

def add_stylesheets
inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/solidus_importer\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/solidus_importer\n", before: %r{\*/}, verbose: true # rubocop:disable Layout/LineLength
end

Expand Down
5 changes: 3 additions & 2 deletions lib/solidus_importer/processors/taxon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ def add_taxon(taxon)
def prepare_taxon(name, taxonomy)
Spree::Taxon.find_or_initialize_by(
name: name,
taxonomy_id: taxonomy.id
)
taxonomy_id: taxonomy.id,
parent: taxonomy.root
).tap(&:validate!)
end

def tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
let(:context) do
{
data: { 'Variant Image' => 'http://remote-service.net/thinking-cat.jpg' },
variant: build_stubbed(:variant)
variant: create(:variant)
}
end
let(:uri) do
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Configure Rails Environment
ENV['RAILS_ENV'] = 'test'
ENV['FRONTEND'] = 'none'

# Run Coverage report
require 'solidus_dev_support/rspec/coverage'
Expand Down

0 comments on commit 0c7b216

Please sign in to comment.