-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for v3.1 #6
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'solidus_dev_support/rake_tasks' | ||
require 'rubocop/rake_task' | ||
|
||
SolidusDevSupport::RakeTasks.install | ||
RuboCop::RakeTask.new | ||
|
||
task default: %i(rubocop extension:specs) | ||
task default: 'extension:specs' | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,6 @@ class Locality < Spree::Base | |
belongs_to :state, class_name: 'Spree::State' | ||
has_one :country, through: :state | ||
|
||
validates :name, presence: true, uniqueness: { scope: :state_id } | ||
validates :name, presence: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why need to remove this validation? I think we should keep to ensure don't have duplicated cities for state |
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'solidus_core' | ||
require 'solidus_backend' | ||
require 'solidus_support' | ||
require 'deface' | ||
|
||
require 'solidus_zones_by_city/version' | ||
require 'solidus_zones_by_city/engine' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ | |
locality do |address| | ||
state = address.state | ||
Spree::Locality.find_by(name: city_name, state: state) || | ||
create(:city, name: city_name, state: state) | ||
create(:locality, name: city_name, state: state) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our factory is named |
||
end | ||
end | ||
end | ||
|
@@ -45,7 +45,7 @@ | |
locality do |stock_location| | ||
state = stock_location.state | ||
Spree::Locality.find_by(name: city_name, state: state) || | ||
create(:city, name: city_name, state: state) | ||
create(:locality, name: city_name, state: state) | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,36 +2,39 @@ | |
|
||
require_relative 'lib/solidus_zones_by_city/version' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = 'solidus_zones_by_city' | ||
spec.version = SolidusZonesByCity::VERSION | ||
spec.authors = ['César Carruitero'] | ||
spec.email = 'ccarruitero@protonmail.com' | ||
Gem::Specification.new do |s| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think is unnecessary rename the block variable |
||
s.name = 'solidus_zones_by_city' | ||
s.version = SolidusZonesByCity::VERSION | ||
s.authors = ['César Carruitero'] | ||
s.email = 'ccarruitero@protonmail.com' | ||
Comment on lines
+8
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was added when bootstrap the extension, but should be updated to Magma Labs |
||
|
||
spec.summary = 'Allow zones at city level' | ||
spec.description = spec.summary | ||
spec.homepage = 'https://github.com/magma-labs/solidus_zones_by_city' | ||
spec.license = 'BSD-3-Clause' | ||
s.summary = 'Allow zones at city level' | ||
s.description = s.summary | ||
s.homepage = 'http://github.com/magma-labs/solidus_zones_by_city' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to keep https in urls |
||
s.license = 'BSD-3-Clause' | ||
|
||
spec.metadata['homepage_uri'] = spec.homepage | ||
spec.metadata['source_code_uri'] = 'https://github.com/magma-labs/solidus_zones_by_city' | ||
spec.metadata['changelog_uri'] = 'https://github.com/magma-labs/solidus_zones_by_city/releases' | ||
if s.respond_to?(:metadata) | ||
s.metadata['homepage_uri'] = s.homepage if s.homepage | ||
s.metadata['source_code_uri'] = s.homepage if s.homepage | ||
end | ||
|
||
spec.required_ruby_version = Gem::Requirement.new('~> 2.5') | ||
s.required_ruby_version = Gem::Requirement.new('>= 2.5') | ||
|
||
# Specify which files should be added to the gem when it is released. | ||
# The `git ls-files -z` loads the files in the RubyGem that have been added into git. | ||
files = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") } | ||
|
||
spec.files = files.grep_v(%r{^(test|spec|features)/}) | ||
spec.test_files = files.grep(%r{^(test|spec|features)/}) | ||
spec.bindir = "exe" | ||
spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) } | ||
spec.require_paths = ["lib"] | ||
|
||
spec.add_dependency 'solidus_core', ['>= 2.0.0', '< 3'] | ||
spec.add_dependency 'solidus_support', '~> 0.5' | ||
|
||
spec.add_development_dependency 'shoulda-matchers' | ||
spec.add_development_dependency 'solidus_dev_support' | ||
s.files = files.grep_v(%r{^(test|spec|features)/}) | ||
s.test_files = files.grep(%r{^(test|spec|features)/}) | ||
s.bindir = "exe" | ||
s.executables = files.grep(%r{^exe/}) { |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
|
||
s.add_dependency 'deface', '~> 1.0' | ||
s.add_dependency 'solidus_backend', ['>= 2.5', '< 4'] | ||
s.add_dependency 'solidus_core', ['>= 2.5', '< 4'] | ||
s.add_dependency 'solidus_support', '~> 0.5' | ||
|
||
s.add_development_dependency 'autoprefixer-rails', '~> 10.2.5' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Until I can see in their repository, is for add browser prefix in our css. I think we should avoid use browser specific css and instead use standard css. |
||
s.add_development_dependency 'rspec-activemodel-mocks' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking into gem repository doesn't found a good reason to add. What is the advance of using this gem over use |
||
s.add_development_dependency 'shoulda-matchers' | ||
s.add_development_dependency 'solidus_dev_support', '~> 2.3' | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
RSpec.describe Spree::Locality, type: :model do | ||
describe 'associations' do | ||
it { is_expected.to belong_to(:state) } | ||
end | ||
|
||
describe 'validations' do | ||
it { is_expected.to validate_presence_of(:name) } | ||
it { is_expected.to validate_uniqueness_of(:name).scoped_to(:state_id) } | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
# Configure Rails Environment | ||
ENV['RAILS_ENV'] = 'test' | ||
|
||
require 'shoulda/matchers' | ||
|
||
# Run Coverage report | ||
require 'solidus_dev_support/rspec/coverage' | ||
|
||
|
@@ -20,8 +18,8 @@ | |
# in spec/support/ and its subdirectories. | ||
Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f } | ||
|
||
# Requires factories defined in lib/solidus_zones_by_city/factories.rb | ||
require 'solidus_zones_by_city/factories' | ||
# Requires factories defined in lib/solidus_related_products/testing_support/factories.rb | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is a typo here |
||
SolidusDevSupport::TestingSupport::Factories.load_for(SolidusZonesByCity::Engine) | ||
|
||
RSpec.configure do |config| | ||
config.infer_spec_type_from_file_location! | ||
|
@@ -31,10 +29,3 @@ | |
config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :system | ||
end | ||
end | ||
|
||
Shoulda::Matchers.configure do |config| | ||
config.integrate do |with| | ||
with.test_framework :rspec | ||
with.library :rails | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rspec-activemodel-mocks' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'shoulda-matchers' | ||
|
||
Shoulda::Matchers.configure do |config| | ||
config.integrate do |with| | ||
with.test_framework :rspec | ||
with.library :rails | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to keep rubocop in default task, that way is more easier notice when is failing