solidus_frontend 2.10.0 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of solidus_frontend might be problematic. Click here for more details.

Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/frontend/checkout/address.js +1 -1
  3. data/app/assets/javascripts/spree/frontend/checkout/coupon-code.js +1 -1
  4. data/app/controllers/spree/checkout_controller.rb +26 -10
  5. data/app/controllers/spree/orders_controller.rb +9 -9
  6. data/app/controllers/spree/products_controller.rb +1 -1
  7. data/app/views/spree/address/_form.html.erb +15 -8
  8. data/app/views/spree/address/_form_hidden.html.erb +6 -2
  9. data/app/views/spree/checkout/payment/_gateway.html.erb +1 -1
  10. data/app/views/spree/orders/_form.html.erb +1 -1
  11. data/app/views/spree/shared/_address.html.erb +1 -1
  12. data/app/views/spree/shared/_image.html.erb +3 -2
  13. data/solidus_frontend.gemspec +5 -5
  14. metadata +13 -56
  15. data/script/rails +0 -10
  16. data/spec/controllers/controller_helpers_spec.rb +0 -29
  17. data/spec/controllers/locale_controller_spec.rb +0 -57
  18. data/spec/controllers/spree/checkout_controller_spec.rb +0 -581
  19. data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -37
  20. data/spec/controllers/spree/content_controller_spec.rb +0 -9
  21. data/spec/controllers/spree/current_order_tracking_spec.rb +0 -47
  22. data/spec/controllers/spree/home_controller_spec.rb +0 -29
  23. data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -90
  24. data/spec/controllers/spree/orders_controller_spec.rb +0 -254
  25. data/spec/controllers/spree/orders_controller_transitions_spec.rb +0 -33
  26. data/spec/controllers/spree/products_controller_spec.rb +0 -38
  27. data/spec/controllers/spree/taxons_controller_spec.rb +0 -14
  28. data/spec/features/address_spec.rb +0 -78
  29. data/spec/features/automatic_promotion_adjustments_spec.rb +0 -49
  30. data/spec/features/caching/products_spec.rb +0 -48
  31. data/spec/features/caching/taxons_spec.rb +0 -21
  32. data/spec/features/cart_spec.rb +0 -85
  33. data/spec/features/checkout_confirm_insufficient_stock_spec.rb +0 -71
  34. data/spec/features/checkout_spec.rb +0 -750
  35. data/spec/features/checkout_unshippable_spec.rb +0 -37
  36. data/spec/features/coupon_code_spec.rb +0 -266
  37. data/spec/features/currency_spec.rb +0 -20
  38. data/spec/features/first_order_promotion_spec.rb +0 -59
  39. data/spec/features/free_shipping_promotions_spec.rb +0 -60
  40. data/spec/features/locale_spec.rb +0 -26
  41. data/spec/features/order_spec.rb +0 -73
  42. data/spec/features/products_spec.rb +0 -291
  43. data/spec/features/promotion_code_invalidation_spec.rb +0 -54
  44. data/spec/features/quantity_promotions_spec.rb +0 -130
  45. data/spec/features/taxons_spec.rb +0 -158
  46. data/spec/features/template_rendering_spec.rb +0 -20
  47. data/spec/fixtures/thinking-cat.jpg +0 -0
  48. data/spec/generators/solidus/views/override_generator_spec.rb +0 -50
  49. data/spec/helpers/base_helper_spec.rb +0 -13
  50. data/spec/helpers/order_helper_spec.rb +0 -14
  51. data/spec/helpers/taxon_filters_helper_spec.rb +0 -12
  52. data/spec/spec_helper.rb +0 -106
  53. data/spec/support/shared_contexts/checkout_setup.rb +0 -12
  54. data/spec/support/shared_contexts/custom_products.rb +0 -28
  55. data/spec/support/shared_contexts/locales.rb +0 -16
  56. data/spec/views/spree/checkout/_summary_spec.rb +0 -11
@@ -1,158 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe "viewing products", type: :feature, inaccessible: true do
6
- let!(:taxonomy) { create(:taxonomy, name: "Category") }
7
- let!(:super_clothing) { taxonomy.root.children.create(name: "Super Clothing") }
8
- let!(:t_shirts) { super_clothing.children.create(name: "T-Shirts") }
9
- let!(:xxl) { t_shirts.children.create(name: "XXL") }
10
- let!(:product) do
11
- product = create(:product, name: "Superman T-Shirt")
12
- product.taxons << t_shirts
13
- end
14
- let(:metas) { { meta_description: 'Brand new Ruby on Rails TShirts', meta_title: "Ruby On Rails TShirt", meta_keywords: 'ror, tshirt, ruby' } }
15
- let(:store_name) do
16
- ((first_store = Spree::Store.first) && first_store.name).to_s
17
- end
18
-
19
- # Regression test for https://github.com/spree/spree/issues/1796
20
- it "can see a taxon's products, even if that taxon has child taxons" do
21
- visit '/t/category/super-clothing/t-shirts'
22
- expect(page).to have_content("Superman T-Shirt")
23
- end
24
-
25
- it "shouldn't show nested taxons with a search" do
26
- visit '/t/category/super-clothing?keywords=shirt'
27
- expect(page).to have_content("Superman T-Shirt")
28
- expect(page).not_to have_selector("div[data-hook='taxon_children']")
29
- end
30
-
31
- describe 'meta tags and title' do
32
- it 'displays metas' do
33
- t_shirts.update metas
34
- visit '/t/category/super-clothing/t-shirts'
35
- expect(page).to have_meta(:description, 'Brand new Ruby on Rails TShirts')
36
- expect(page).to have_meta(:keywords, 'ror, tshirt, ruby')
37
- end
38
-
39
- it 'display title if set' do
40
- t_shirts.update metas
41
- visit '/t/category/super-clothing/t-shirts'
42
- expect(page).to have_title("Ruby On Rails TShirt")
43
- end
44
-
45
- it 'displays title from taxon root and taxon name' do
46
- visit '/t/category/super-clothing/t-shirts'
47
- expect(page).to have_title('Category - T-Shirts - ' + store_name)
48
- end
49
-
50
- # Regression test for https://github.com/spree/spree/issues/2814
51
- it "doesn't use meta_title as heading on page" do
52
- t_shirts.update metas
53
- visit '/t/category/super-clothing/t-shirts'
54
- within("h1.taxon-title") do
55
- expect(page).to have_content(t_shirts.name)
56
- end
57
- end
58
-
59
- it 'uses taxon name in title when meta_title set to empty string' do
60
- t_shirts.update meta_title: ''
61
- visit '/t/category/super-clothing/t-shirts'
62
- expect(page).to have_title('Category - T-Shirts - ' + store_name)
63
- end
64
- end
65
-
66
- context "taxon pages" do
67
- include_context "custom products"
68
- before do
69
- visit spree.root_path
70
- end
71
-
72
- it "should be able to visit brand Ruby on Rails" do
73
- within(:css, '#taxonomies') { click_link "Ruby on Rails" }
74
-
75
- expect(page.all('ul.product-listing li').size).to eq(7)
76
- tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
77
- tmp.delete("")
78
- array = ["Ruby on Rails Bag",
79
- "Ruby on Rails Baseball Jersey",
80
- "Ruby on Rails Jr. Spaghetti",
81
- "Ruby on Rails Mug",
82
- "Ruby on Rails Ringer T-Shirt",
83
- "Ruby on Rails Stein",
84
- "Ruby on Rails Tote"]
85
- expect(tmp.sort!).to eq(array)
86
- end
87
-
88
- it "should be able to visit brand Ruby" do
89
- within(:css, '#taxonomies') { click_link "Ruby" }
90
-
91
- expect(page.all('ul.product-listing li').size).to eq(1)
92
- tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
93
- tmp.delete("")
94
- expect(tmp.sort!).to eq(["Ruby Baseball Jersey"])
95
- end
96
-
97
- it "should be able to visit brand Apache" do
98
- within(:css, '#taxonomies') { click_link "Apache" }
99
-
100
- expect(page.all('ul.product-listing li').size).to eq(1)
101
- tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
102
- tmp.delete("")
103
- expect(tmp.sort!).to eq(["Apache Baseball Jersey"])
104
- end
105
-
106
- it "should be able to visit category Clothing" do
107
- click_link "Clothing"
108
-
109
- expect(page.all('ul.product-listing li').size).to eq(5)
110
- tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
111
- tmp.delete("")
112
- expect(tmp.sort!).to eq(["Apache Baseball Jersey",
113
- "Ruby Baseball Jersey",
114
- "Ruby on Rails Baseball Jersey",
115
- "Ruby on Rails Jr. Spaghetti",
116
- "Ruby on Rails Ringer T-Shirt"])
117
- end
118
-
119
- it "should be able to visit category Mugs" do
120
- click_link "Mugs"
121
-
122
- expect(page.all('ul.product-listing li').size).to eq(2)
123
- tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
124
- tmp.delete("")
125
- expect(tmp.sort!).to eq(["Ruby on Rails Mug", "Ruby on Rails Stein"])
126
- end
127
-
128
- it "should be able to visit category Bags" do
129
- click_link "Bags"
130
-
131
- expect(page.all('ul.product-listing li').size).to eq(2)
132
- tmp = page.all('ul.product-listing li a').map(&:text).flatten.compact
133
- tmp.delete("")
134
- expect(tmp.sort!).to eq(["Ruby on Rails Bag", "Ruby on Rails Tote"])
135
- end
136
- end
137
-
138
- # Regression test for https://github.com/solidusio/solidus/issues/2602
139
- context "root taxon page" do
140
- it "shows taxon previews" do
141
- visit spree.nested_taxons_path(taxonomy.root)
142
-
143
- expect(page).to have_css('ul.product-listing li', count: 2)
144
- expect(page).to have_content("Superman T-Shirt", count: 2)
145
- end
146
-
147
- context "with prices in other currency" do
148
- before { Spree::Price.update_all(currency: "CAD") }
149
-
150
- it "shows no products" do
151
- visit spree.nested_taxons_path(taxonomy.root)
152
-
153
- expect(page).to have_css('ul.product-listing li', count: 0)
154
- expect(page).to have_no_content("Superman T-Shirt")
155
- end
156
- end
157
- end
158
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe "Template rendering", type: :feature do
6
- after do
7
- Capybara.ignore_hidden_elements = true
8
- end
9
-
10
- before do
11
- Capybara.ignore_hidden_elements = false
12
- end
13
-
14
- it 'layout should have canonical tag referencing site url' do
15
- Spree::Store.create!(code: 'spree', name: 'My Spree Store', url: 'spreestore.example.com', mail_from_address: 'test@example.com')
16
-
17
- visit spree.root_path
18
- expect(find('link[rel=canonical]')[:href]).to eql('http://spreestore.example.com/')
19
- end
20
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'generator_spec'
5
- require 'generators/solidus/views/override_generator'
6
-
7
- RSpec.describe Solidus::Views::OverrideGenerator, type: :generator do
8
- destination Rails.root.join('app', 'views', 'spree')
9
-
10
- before(:all) do
11
- prepare_destination
12
- end
13
-
14
- subject! do
15
- run_generator arguments
16
- end
17
-
18
- let(:src) do
19
- Spree::Frontend::Engine.root.join('app', 'views', 'spree')
20
- end
21
-
22
- let(:dest) do
23
- Rails.root.join('app', 'views', 'spree')
24
- end
25
-
26
- context 'without any arguments' do
27
- let(:arguments) { %w() }
28
-
29
- it 'copies all views into the host app' do
30
- expect(src.entries).to match_array(dest.entries)
31
- end
32
- end
33
-
34
- context 'when "products" is passed as --only argument' do
35
- let(:arguments) { %w(--only products) }
36
-
37
- context 'as folder' do
38
- it 'exclusively copies views whose name contains "products"' do
39
- Dir.glob(dest.join("**", "*")).each do |file|
40
- next if File.directory?(file)
41
- expect(file.to_s).to match("products")
42
- end
43
- end
44
- end
45
- end
46
-
47
- after do
48
- FileUtils.rm_rf destination_root
49
- end
50
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- module Spree
6
- describe BaseHelper, type: :helper do
7
- # Regression test for https://github.com/spree/spree/issues/2759
8
- it "nested_taxons_path works with a Taxon object" do
9
- taxon = create(:taxon, name: "iphone")
10
- expect(spree.nested_taxons_path(taxon)).to eq("/t/iphone")
11
- end
12
- end
13
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- module Spree
6
- describe Spree::OrdersHelper, type: :helper do
7
- # Regression test for https://github.com/spree/spree/issues/2518 and https://github.com/spree/spree/issues/2323
8
- it "truncates HTML correctly in product description" do
9
- product = double(description: "<strong>" + ("a" * 95) + "</strong> This content is invisible.")
10
- expected = "<strong>" + ("a" * 95) + "</strong>..."
11
- expect(truncated_product_description(product)).to eq(expected)
12
- end
13
- end
14
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Spree::TaxonFiltersHelper, type: :helper do
6
- let(:taxon) { nil }
7
- subject { applicable_filters_for(taxon) }
8
-
9
- it "returns the price/brand filters" do
10
- expect(subject.map { |y| y[:name] }).to eq ['Brands', 'Price Range']
11
- end
12
- end
@@ -1,106 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- if ENV["COVERAGE"]
4
- require 'simplecov'
5
- SimpleCov.start('rails')
6
- end
7
-
8
- # This file is copied to ~/spec when you run 'ruby script/generate rspec'
9
- # from the project root directory.
10
- ENV["RAILS_ENV"] ||= 'test'
11
-
12
- require 'solidus_frontend'
13
- require 'spree/testing_support/dummy_app'
14
- DummyApp.setup(
15
- gem_root: File.expand_path('..', __dir__),
16
- lib_name: 'solidus_frontend'
17
- )
18
-
19
- require 'rails-controller-testing'
20
- require 'rspec/rails'
21
- require 'rspec-activemodel-mocks'
22
-
23
- # Requires supporting files with custom matchers and macros, etc,
24
- # in ./support/ and its subdirectories.
25
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
26
-
27
- require 'database_cleaner'
28
-
29
- require 'spree/testing_support/partial_double_verification'
30
- require 'spree/testing_support/authorization_helpers'
31
- require 'spree/testing_support/capybara_ext'
32
- require 'spree/testing_support/factories'
33
- require 'spree/testing_support/preferences'
34
- require 'spree/testing_support/controller_requests'
35
- require 'spree/testing_support/flash'
36
- require 'spree/testing_support/url_helpers'
37
- require 'spree/testing_support/order_walkthrough'
38
- require 'spree/testing_support/caching'
39
-
40
- require 'capybara-screenshot/rspec'
41
- Capybara.save_path = ENV['CIRCLE_ARTIFACTS'] if ENV['CIRCLE_ARTIFACTS']
42
- Capybara.default_max_wait_time = ENV['DEFAULT_MAX_WAIT_TIME'].to_f if ENV['DEFAULT_MAX_WAIT_TIME'].present?
43
-
44
- require "selenium/webdriver"
45
- Capybara.javascript_driver = (ENV['CAPYBARA_DRIVER'] || :selenium_chrome_headless).to_sym
46
-
47
- ActiveJob::Base.queue_adapter = :test
48
-
49
- RSpec.configure do |config|
50
- config.color = true
51
- config.infer_spec_type_from_file_location!
52
- config.expect_with :rspec do |c|
53
- c.syntax = :expect
54
- end
55
- config.mock_with :rspec do |c|
56
- c.syntax = :expect
57
- end
58
-
59
- config.fixture_path = File.join(__dir__, "fixtures")
60
-
61
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
62
- # examples within a transaction, comment the following line or assign false
63
- # instead of true.
64
- config.use_transactional_fixtures = true
65
-
66
- if ENV['WEBDRIVER'] == 'accessible'
67
- config.around(:each, inaccessible: true) do |example|
68
- Capybara::Accessible.skip_audit { example.run }
69
- end
70
- end
71
-
72
- config.before(:suite) do
73
- DatabaseCleaner.clean_with :truncation
74
- end
75
-
76
- config.before(:each) do
77
- Rails.cache.clear
78
- end
79
-
80
- config.before(:each, type: :feature) do
81
- if page.driver.browser.respond_to?(:url_blacklist)
82
- page.driver.browser.url_blacklist = ['http://fonts.googleapis.com']
83
- end
84
- end
85
-
86
- config.after(:each, type: :feature) do |example|
87
- missing_translations = page.body.scan(/translation missing: #{I18n.locale}\.(.*?)[\s<\"&]/)
88
- if missing_translations.any?
89
- puts "Found missing translations: #{missing_translations.inspect}"
90
- puts "In spec: #{example.location}"
91
- end
92
- end
93
-
94
- config.include FactoryBot::Syntax::Methods
95
-
96
- config.include Spree::TestingSupport::Preferences
97
- config.include Spree::TestingSupport::UrlHelpers
98
- config.include Spree::TestingSupport::ControllerRequests, type: :controller
99
- config.include Spree::TestingSupport::Flash
100
-
101
- config.example_status_persistence_file_path = "./spec/examples.txt"
102
-
103
- config.order = :random
104
-
105
- Kernel.srand config.seed
106
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- shared_context 'checkout setup' do
4
- let!(:store) { create(:store) }
5
- let!(:country) { create(:country, states_required: true) }
6
- let!(:state) { create(:state, country: country) }
7
- let!(:shipping_method) { create(:shipping_method) }
8
- let!(:stock_location) { create(:stock_location) }
9
- let!(:mug) { create(:product, name: "RoR Mug") }
10
- let!(:payment_method) { create(:check_payment_method) }
11
- let!(:zone) { create(:zone) }
12
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- shared_context "custom products" do
4
- before(:each) do
5
- create(:store)
6
- taxonomy = FactoryBot.create(:taxonomy, name: 'Categories')
7
- root = taxonomy.root
8
- clothing_taxon = FactoryBot.create(:taxon, name: 'Clothing', parent_id: root.id)
9
- bags_taxon = FactoryBot.create(:taxon, name: 'Bags', parent_id: root.id)
10
- mugs_taxon = FactoryBot.create(:taxon, name: 'Mugs', parent_id: root.id)
11
-
12
- taxonomy = FactoryBot.create(:taxonomy, name: 'Brands')
13
- root = taxonomy.root
14
- apache_taxon = FactoryBot.create(:taxon, name: 'Apache', parent_id: root.id)
15
- rails_taxon = FactoryBot.create(:taxon, name: 'Ruby on Rails', parent_id: root.id)
16
- ruby_taxon = FactoryBot.create(:taxon, name: 'Ruby', parent_id: root.id)
17
-
18
- FactoryBot.create(:custom_product, name: 'Ruby on Rails Ringer T-Shirt', price: '19.99', taxons: [rails_taxon, clothing_taxon])
19
- FactoryBot.create(:custom_product, name: 'Ruby on Rails Mug', price: '15.99', taxons: [rails_taxon, mugs_taxon])
20
- FactoryBot.create(:custom_product, name: 'Ruby on Rails Tote', price: '15.99', taxons: [rails_taxon, bags_taxon])
21
- FactoryBot.create(:custom_product, name: 'Ruby on Rails Bag', price: '22.99', taxons: [rails_taxon, bags_taxon])
22
- FactoryBot.create(:custom_product, name: 'Ruby on Rails Baseball Jersey', price: '19.99', taxons: [rails_taxon, clothing_taxon])
23
- FactoryBot.create(:custom_product, name: 'Ruby on Rails Stein', price: '16.99', taxons: [rails_taxon, mugs_taxon])
24
- FactoryBot.create(:custom_product, name: 'Ruby on Rails Jr. Spaghetti', price: '19.99', taxons: [rails_taxon, clothing_taxon])
25
- FactoryBot.create(:custom_product, name: 'Ruby Baseball Jersey', price: '19.99', taxons: [ruby_taxon, clothing_taxon])
26
- FactoryBot.create(:custom_product, name: 'Apache Baseball Jersey', price: '19.99', taxons: [apache_taxon, clothing_taxon])
27
- end
28
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- shared_context 'fr locale' do
4
- before do
5
- I18n.backend.store_translations(:fr, spree: {
6
- i18n: { this_file_language: "Français" },
7
- cart: 'Panier',
8
- shopping_cart: 'Panier'
9
- })
10
- end
11
-
12
- after do
13
- I18n.locale = :en # reset locale after each spec.
14
- I18n.reload!
15
- end
16
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe "spree/checkout/_summary.html.erb", type: :view do
6
- # Regression spec for https://github.com/spree/spree/issues/4223
7
- it "does not use the @order instance variable" do
8
- order = stub_model(Spree::Order)
9
- render partial: "spree/checkout/summary", locals: { order: order }
10
- end
11
- end