spree_frontend 3.2.1 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/spree_frontend.gemspec +2 -3
- metadata +10 -86
- data/spec/controllers/controller_extension_spec.rb +0 -126
- data/spec/controllers/controller_helpers_spec.rb +0 -122
- data/spec/controllers/spree/checkout_controller_spec.rb +0 -515
- data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -36
- data/spec/controllers/spree/content_controller_spec.rb +0 -12
- data/spec/controllers/spree/current_order_tracking_spec.rb +0 -44
- data/spec/controllers/spree/home_controller_spec.rb +0 -47
- data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -96
- data/spec/controllers/spree/orders_controller_spec.rb +0 -134
- data/spec/controllers/spree/orders_controller_transitions_spec.rb +0 -31
- data/spec/controllers/spree/products_controller_spec.rb +0 -87
- data/spec/controllers/spree/taxons_controller_spec.rb +0 -12
- data/spec/features/address_spec.rb +0 -93
- data/spec/features/automatic_promotion_adjustments_spec.rb +0 -47
- data/spec/features/caching/products_spec.rb +0 -59
- data/spec/features/caching/taxons_spec.rb +0 -22
- data/spec/features/cart_spec.rb +0 -132
- data/spec/features/checkout_spec.rb +0 -572
- data/spec/features/checkout_unshippable_spec.rb +0 -34
- data/spec/features/coupon_code_spec.rb +0 -88
- data/spec/features/currency_spec.rb +0 -18
- data/spec/features/delivery_spec.rb +0 -64
- data/spec/features/free_shipping_promotions_spec.rb +0 -59
- data/spec/features/locale_spec.rb +0 -60
- data/spec/features/microdata_spec.rb +0 -0
- data/spec/features/order_spec.rb +0 -107
- data/spec/features/page_promotions_spec.rb +0 -36
- data/spec/features/products_spec.rb +0 -334
- data/spec/features/taxons_spec.rb +0 -147
- data/spec/features/template_rendering_spec.rb +0 -19
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/helpers/frontend_helper_spec.rb +0 -57
- data/spec/helpers/taxons_helper_spec.rb +0 -17
- data/spec/spec_helper.rb +0 -126
- data/spec/support/shared_contexts/checkout_setup.rb +0 -10
- data/spec/support/shared_contexts/custom_products.rb +0 -25
- data/spec/support/shared_contexts/product_prototypes.rb +0 -30
- data/spec/views/spree/checkout/_summary_spec.rb +0 -11
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Template rendering", type: :feature do
|
4
|
-
|
5
|
-
after do
|
6
|
-
Capybara.ignore_hidden_elements = true
|
7
|
-
end
|
8
|
-
|
9
|
-
before do
|
10
|
-
Capybara.ignore_hidden_elements = false
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'layout should have canonical tag referencing site url' do
|
14
|
-
Spree::Store.create!(code: 'spree', name: 'My Spree Store', url: 'spreestore.example.com', mail_from_address: 'test@example.com')
|
15
|
-
|
16
|
-
visit spree.root_path
|
17
|
-
expect(find('link[rel=canonical]')[:href]).to eql('http://spreestore.example.com/')
|
18
|
-
end
|
19
|
-
end
|
Binary file
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Spree
|
4
|
-
describe FrontendHelper, type: :helper do
|
5
|
-
# Regression test for #2034
|
6
|
-
context "flash_message" do
|
7
|
-
let(:flash) { { "notice" => "ok", "foo" => "foo", "bar" => "bar" } }
|
8
|
-
|
9
|
-
it "should output all flash content" do
|
10
|
-
flash_messages
|
11
|
-
html = Nokogiri::HTML(helper.output_buffer)
|
12
|
-
expect(html.css(".alert-notice").text).to eq("ok")
|
13
|
-
expect(html.css(".alert-foo").text).to eq("foo")
|
14
|
-
expect(html.css(".alert-bar").text).to eq("bar")
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should output flash content except one key" do
|
18
|
-
flash_messages(ignore_types: :bar)
|
19
|
-
html = Nokogiri::HTML(helper.output_buffer)
|
20
|
-
expect(html.css(".alert-notice").text).to eq("ok")
|
21
|
-
expect(html.css(".alert-foo").text).to eq("foo")
|
22
|
-
expect(html.css(".alert-bar").text).to be_empty
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should output flash content except some keys" do
|
26
|
-
flash_messages(ignore_types: [:foo, :bar])
|
27
|
-
html = Nokogiri::HTML(helper.output_buffer)
|
28
|
-
expect(html.css(".alert-notice").text).to eq("ok")
|
29
|
-
expect(html.css(".alert-foo").text).to be_empty
|
30
|
-
expect(html.css(".alert-bar").text).to be_empty
|
31
|
-
expect(helper.output_buffer).to eq("<div class=\"alert alert-notice\">ok</div>")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# Regression test for #2759
|
36
|
-
it "nested_taxons_path works with a Taxon object" do
|
37
|
-
taxon = create(:taxon, name: "iphone")
|
38
|
-
expect(spree.nested_taxons_path(taxon)).to eq("/t/iphone")
|
39
|
-
end
|
40
|
-
|
41
|
-
context '#checkout_progress' do
|
42
|
-
before do
|
43
|
-
@order = create(:order, state: 'address')
|
44
|
-
end
|
45
|
-
|
46
|
-
it 'does not include numbers by default' do
|
47
|
-
output = checkout_progress
|
48
|
-
expect(output).to_not include('1.')
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'has option to include numbers' do
|
52
|
-
output = checkout_progress(numbers: true)
|
53
|
-
expect(output).to include('1.')
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Spree::TaxonsHelper, type: :helper do
|
4
|
-
# Regression test for #4382
|
5
|
-
it "#taxon_preview" do
|
6
|
-
taxon = create(:taxon)
|
7
|
-
child_taxon = create(:taxon, parent: taxon)
|
8
|
-
product_1 = create(:product)
|
9
|
-
product_2 = create(:product)
|
10
|
-
product_3 = create(:product)
|
11
|
-
taxon.products << product_1
|
12
|
-
taxon.products << product_2
|
13
|
-
child_taxon.products << product_3
|
14
|
-
|
15
|
-
expect(taxon_preview(taxon.reload)).to eql([product_1, product_2, product_3])
|
16
|
-
end
|
17
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
if ENV["COVERAGE"]
|
2
|
-
# Run Coverage report
|
3
|
-
require 'simplecov'
|
4
|
-
SimpleCov.start do
|
5
|
-
add_group 'Controllers', 'app/controllers'
|
6
|
-
add_group 'Helpers', 'app/helpers'
|
7
|
-
add_group 'Mailers', 'app/mailers'
|
8
|
-
add_group 'Models', 'app/models'
|
9
|
-
add_group 'Views', 'app/views'
|
10
|
-
add_group 'Libraries', 'lib'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
15
|
-
# from the project root directory.
|
16
|
-
ENV["RAILS_ENV"] ||= 'test'
|
17
|
-
|
18
|
-
begin
|
19
|
-
require File.expand_path("../dummy/config/environment", __FILE__)
|
20
|
-
rescue LoadError
|
21
|
-
puts "Could not load dummy application. Please ensure you have run `bundle exec rake test_app`"
|
22
|
-
exit
|
23
|
-
end
|
24
|
-
|
25
|
-
require 'rspec/rails'
|
26
|
-
require 'ffaker'
|
27
|
-
|
28
|
-
# Requires supporting files with custom matchers and macros, etc,
|
29
|
-
# in ./support/ and its subdirectories.
|
30
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
31
|
-
|
32
|
-
require 'database_cleaner'
|
33
|
-
|
34
|
-
if ENV["CHECK_TRANSLATIONS"]
|
35
|
-
require "spree/testing_support/i18n"
|
36
|
-
end
|
37
|
-
|
38
|
-
require 'spree/testing_support/authorization_helpers'
|
39
|
-
require 'spree/testing_support/capybara_ext'
|
40
|
-
require 'spree/testing_support/factories'
|
41
|
-
require 'spree/testing_support/preferences'
|
42
|
-
require 'spree/testing_support/controller_requests'
|
43
|
-
require 'spree/testing_support/flash'
|
44
|
-
require 'spree/testing_support/url_helpers'
|
45
|
-
require 'spree/testing_support/order_walkthrough'
|
46
|
-
require 'spree/testing_support/caching'
|
47
|
-
require 'spree/testing_support/shoulda_matcher_configuration'
|
48
|
-
require 'spree/testing_support/microdata'
|
49
|
-
|
50
|
-
require 'paperclip/matchers'
|
51
|
-
|
52
|
-
require 'capybara-screenshot/rspec'
|
53
|
-
Capybara.save_path = ENV['CIRCLE_ARTIFACTS'] if ENV['CIRCLE_ARTIFACTS']
|
54
|
-
|
55
|
-
if ENV['WEBDRIVER'] == 'accessible'
|
56
|
-
require 'capybara/accessible'
|
57
|
-
Capybara.javascript_driver = :accessible
|
58
|
-
else
|
59
|
-
require 'capybara/poltergeist'
|
60
|
-
Capybara.javascript_driver = :poltergeist
|
61
|
-
end
|
62
|
-
|
63
|
-
RSpec.configure do |config|
|
64
|
-
config.color = true
|
65
|
-
config.fail_fast = ENV['FAIL_FAST'] || false
|
66
|
-
config.fixture_path = File.join(File.expand_path(File.dirname(__FILE__)), "fixtures")
|
67
|
-
config.infer_spec_type_from_file_location!
|
68
|
-
config.mock_with :rspec
|
69
|
-
config.raise_errors_for_deprecations!
|
70
|
-
|
71
|
-
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
72
|
-
# examples within a transaction, comment the following line or assign false
|
73
|
-
# instead of true.
|
74
|
-
config.use_transactional_fixtures = false
|
75
|
-
|
76
|
-
if ENV['WEBDRIVER'] == 'accessible'
|
77
|
-
config.around(:each, inaccessible: true) do |example|
|
78
|
-
Capybara::Accessible.skip_audit { example.run }
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# Ensure DB is clean, so that transaction isolated specs see
|
83
|
-
# pristine state.
|
84
|
-
config.before(:suite) do
|
85
|
-
DatabaseCleaner.strategy = :truncation
|
86
|
-
DatabaseCleaner.clean
|
87
|
-
end
|
88
|
-
|
89
|
-
config.before(:each) do
|
90
|
-
WebMock.disable!
|
91
|
-
if RSpec.current_example.metadata[:js]
|
92
|
-
DatabaseCleaner.strategy = :truncation
|
93
|
-
else
|
94
|
-
DatabaseCleaner.strategy = :transaction
|
95
|
-
end
|
96
|
-
# TODO: Find out why open_transactions ever gets below 0
|
97
|
-
# See issue #3428
|
98
|
-
if ApplicationRecord.connection.open_transactions < 0
|
99
|
-
ApplicationRecord.connection.increment_open_transactions
|
100
|
-
end
|
101
|
-
DatabaseCleaner.start
|
102
|
-
reset_spree_preferences
|
103
|
-
end
|
104
|
-
|
105
|
-
config.after(:each) do
|
106
|
-
DatabaseCleaner.clean
|
107
|
-
end
|
108
|
-
|
109
|
-
config.after(:each, type: :feature) do |example|
|
110
|
-
missing_translations = page.body.scan(/translation missing: #{I18n.locale}\.(.*?)[\s<\"&]/)
|
111
|
-
if missing_translations.any?
|
112
|
-
puts "Found missing translations: #{missing_translations.inspect}"
|
113
|
-
puts "In spec: #{example.location}"
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
config.include FactoryGirl::Syntax::Methods
|
119
|
-
|
120
|
-
config.include Spree::TestingSupport::Preferences
|
121
|
-
config.include Spree::TestingSupport::UrlHelpers
|
122
|
-
config.include Spree::TestingSupport::ControllerRequests, type: :controller
|
123
|
-
config.include Spree::TestingSupport::Flash
|
124
|
-
|
125
|
-
config.include Paperclip::Shoulda::Matchers
|
126
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
shared_context 'checkout setup' do
|
2
|
-
let!(:country) { create(:country, states_required: true) }
|
3
|
-
let!(:state) { create(:state, country: country) }
|
4
|
-
let!(:shipping_method) { create(:shipping_method) }
|
5
|
-
let!(:stock_location) { create(:stock_location) }
|
6
|
-
let!(:mug) { create(:product, name: "RoR Mug") }
|
7
|
-
let!(:payment_method) { create(:check_payment_method) }
|
8
|
-
let!(:zone) { create(:zone) }
|
9
|
-
let!(:store) { create(:store) }
|
10
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
shared_context "custom products" do
|
2
|
-
before(:each) do
|
3
|
-
taxonomy = FactoryGirl.create(:taxonomy, name: 'Categories')
|
4
|
-
root = taxonomy.root
|
5
|
-
clothing_taxon = FactoryGirl.create(:taxon, name: 'Clothing', parent_id: root.id)
|
6
|
-
bags_taxon = FactoryGirl.create(:taxon, name: 'Bags', parent_id: root.id)
|
7
|
-
mugs_taxon = FactoryGirl.create(:taxon, name: 'Mugs', parent_id: root.id)
|
8
|
-
|
9
|
-
taxonomy = FactoryGirl.create(:taxonomy, name: 'Brands')
|
10
|
-
root = taxonomy.root
|
11
|
-
apache_taxon = FactoryGirl.create(:taxon, name: 'Apache', parent_id: root.id)
|
12
|
-
rails_taxon = FactoryGirl.create(:taxon, name: 'Ruby on Rails', parent_id: root.id)
|
13
|
-
ruby_taxon = FactoryGirl.create(:taxon, name: 'Ruby', parent_id: root.id)
|
14
|
-
|
15
|
-
FactoryGirl.create(:custom_product, name: 'Ruby on Rails Ringer T-Shirt', price: '19.99', taxons: [rails_taxon, clothing_taxon])
|
16
|
-
FactoryGirl.create(:custom_product, name: 'Ruby on Rails Mug', price: '15.99', taxons: [rails_taxon, mugs_taxon])
|
17
|
-
FactoryGirl.create(:custom_product, name: 'Ruby on Rails Tote', price: '15.99', taxons: [rails_taxon, bags_taxon])
|
18
|
-
FactoryGirl.create(:custom_product, name: 'Ruby on Rails Bag', price: '22.99', taxons: [rails_taxon, bags_taxon])
|
19
|
-
FactoryGirl.create(:custom_product, name: 'Ruby on Rails Baseball Jersey', price: '19.99', taxons: [rails_taxon, clothing_taxon])
|
20
|
-
FactoryGirl.create(:custom_product, name: 'Ruby on Rails Stein', price: '16.99', taxons: [rails_taxon, mugs_taxon])
|
21
|
-
FactoryGirl.create(:custom_product, name: 'Ruby on Rails Jr. Spaghetti', price: '19.99', taxons: [rails_taxon, clothing_taxon])
|
22
|
-
FactoryGirl.create(:custom_product, name: 'Ruby Baseball Jersey', price: '19.99', taxons: [ruby_taxon, clothing_taxon])
|
23
|
-
FactoryGirl.create(:custom_product, name: 'Apache Baseball Jersey', price: '19.99', taxons: [apache_taxon, clothing_taxon])
|
24
|
-
end
|
25
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
shared_context "product prototype" do
|
2
|
-
|
3
|
-
def build_option_type_with_values(name, values)
|
4
|
-
ot = FactoryGirl.create(:option_type, name: name)
|
5
|
-
values.each do |val|
|
6
|
-
ot.option_values.create(name: val.downcase, presentation: val)
|
7
|
-
end
|
8
|
-
ot
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:product_attributes) do
|
12
|
-
# FactoryGirl.attributes_for is un-deprecated!
|
13
|
-
# https://github.com/thoughtbot/factory_girl/issues/274#issuecomment-3592054
|
14
|
-
FactoryGirl.attributes_for(:base_product)
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:prototype) do
|
18
|
-
size = build_option_type_with_values("size", %w(Small Medium Large))
|
19
|
-
FactoryGirl.create(:prototype, name: "Size", option_types: [ size ])
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:option_values_hash) do
|
23
|
-
hash = {}
|
24
|
-
prototype.option_types.each do |i|
|
25
|
-
hash[i.id.to_s] = i.option_value_ids
|
26
|
-
end
|
27
|
-
hash
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "spree/checkout/_summary.html.erb", type: :view do
|
4
|
-
# Regression spec for #4223
|
5
|
-
it "does not use the @order instance variable" do
|
6
|
-
order = stub_model(Spree::Order)
|
7
|
-
expect do
|
8
|
-
render partial: "spree/checkout/summary", locals: {order: order}
|
9
|
-
end.not_to raise_error
|
10
|
-
end
|
11
|
-
end
|