solidus_multi_domain 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b8bdc0340da89be57fbe0bc2b9bb9bf6044576e
4
- data.tar.gz: 5973b260b06c23a72a87aa8e8337ae441dec038f
3
+ metadata.gz: bb3f5dcfd0e9f2e1cd6eb1b6fc001442e04f37d7
4
+ data.tar.gz: ccbe9774d8f526ebbeed4b18ee170a3fc6ad9e4a
5
5
  SHA512:
6
- metadata.gz: d66c31d78d2f144edd1b3b145ca0226968f9e52eb7e15fc332c8583287ae906f6c047c924e42b0f5ed6e84b78a46da7210df147667771d3027ad7b3d55091869
7
- data.tar.gz: d3f62ce75db1290aa3eb6369d18dbcfec2c77b1f213777ad846b693b9032a27af584ed36cfc008e6bc386aaa82a52ca59c89bd15bc6af8d5aa483c03febb3bbb
6
+ metadata.gz: ff5e70b3ae70fa83bdefc3eff867582ec51bfe15ad61509e9340122c0ab965f11288c01f8dca01f07be317c482b0ac593f4470062951b8f4f6158de1d91a9371
7
+ data.tar.gz: 4f86e155a58580fd34b66e65e65a27a8715c7fc06c89ebec5e6c414d476c513b524f767c49e92c49d6c7beb02afe0f79595dc39b2465dfbaa51c7ce6b894d6d5
data/.gitignore CHANGED
@@ -31,3 +31,4 @@ coverage/*
31
31
  Gemfile.lock
32
32
  .ruby-version
33
33
  .ruby-gemset
34
+ pkg
@@ -6,7 +6,9 @@ env:
6
6
  matrix:
7
7
  - SOLIDUS_BRANCH=v1.1 DB=postgres
8
8
  - SOLIDUS_BRANCH=v1.2 DB=postgres
9
+ - SOLIDUS_BRANCH=v1.3 DB=postgres
9
10
  - SOLIDUS_BRANCH=master DB=postgres
10
11
  - SOLIDUS_BRANCH=v1.1 DB=mysql
11
12
  - SOLIDUS_BRANCH=v1.2 DB=mysql
13
+ - SOLIDUS_BRANCH=v1.3 DB=mysql
12
14
  - SOLIDUS_BRANCH=master DB=mysql
data/README.md CHANGED
@@ -61,12 +61,18 @@ You should see 'Stores & Domains' in Configuration tab of Spree Admin.
61
61
  Development
62
62
  -------
63
63
 
64
- To see if your stores indeed do point to the correct and unique domains, start your server with
64
+ To see if your stores indeed do point to the correct and unique domains, start your server with
65
65
  ```shell
66
66
  rails s -p 3000 -b lvh.me
67
67
  ```
68
68
  and give a store a domain like http://store1.lvh.me:3000/.
69
69
 
70
+ If you'd like access to Solidus factories for your own tests that work well
71
+ with this extension, add the following to your `spec_helper`:
72
+ ```ruby
73
+ require "spree_multi_domain/testing_support/factory_overrides"
74
+ ```
75
+
70
76
  Authorization
71
77
  -------------
72
78
 
@@ -20,7 +20,7 @@ module SpreeMultiDomain
20
20
  initializer "templates with dynamic layouts" do |app|
21
21
  ActionView::TemplateRenderer.class_eval do
22
22
  def find_layout_with_multi_store(layout, locals)
23
- if @view.respond_to?(:current_store) && @view.current_store && !@view.controller.is_a?(Spree::Admin::BaseController) && layout.call.present?
23
+ if @view.respond_to?(:current_store) && @view.current_store && !@view.controller.is_a?(Spree::Admin::BaseController)
24
24
  store_layout = if layout.is_a?(String)
25
25
  layout.gsub("layouts/", "layouts/#{@view.current_store.code}/")
26
26
  else
@@ -1,8 +1,8 @@
1
1
  FactoryGirl.modify do
2
2
  # Products need to belong to the same store as the order.
3
3
  factory :line_item do
4
- before(:create) do |line_item, evaluator|
5
- if line_item.order.store
4
+ after(:build) do |line_item, evaluator|
5
+ if line_item.order.store && line_item.product.stores.empty?
6
6
  line_item.product.stores << line_item.order.store
7
7
  end
8
8
  end
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |s|
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.name = "solidus_multi_domain"
6
- s.version = "1.2.0"
6
+ s.version = "1.3.0"
7
7
  s.summary = "Adds multiple site support to Solidus"
8
8
  s.description = "Multiple Solidus stores on different domains - single unified backed for processing orders."
9
9
  s.required_ruby_version = ">= 2.1"
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe "spree core factories should not raise ProductDoesNotBelongToStoreError" do
4
+ it "should be able to build a line_item" do
5
+ expect { build(:line_item) }.not_to raise_error
6
+ end
7
+
8
+ it "should be able to create a line_item" do
9
+ expect { create(:line_item) }.not_to raise_error
10
+ end
11
+
12
+ it "should be able to create a line_item with a specified variant" do
13
+ expect { create(:line_item, variant: create(:variant, price: 100.00)) }.not_to raise_error
14
+ end
15
+
16
+ it "should be able to build an inventory_unit" do
17
+ expect { build(:inventory_unit) }.not_to raise_error
18
+ end
19
+
20
+ it "should be able to create an inventory_unit" do
21
+ expect { create(:inventory_unit) }.not_to raise_error
22
+ end
23
+ end
@@ -41,4 +41,30 @@ describe "Template renderer with dynamic layouts" do
41
41
  expect(response.body).to eq("Store layout just normal")
42
42
  end
43
43
  end
44
+
45
+ context "with an explicit `layout` passed to render" do
46
+ ExplicitLayoutController = Class.new(ApplicationController) do
47
+ def index
48
+ render :index, layout: 'fancy'
49
+ end
50
+ end
51
+
52
+ before do
53
+ ApplicationController.view_paths += [ActionView::FixtureResolver.new(
54
+ "layouts/fancy.html.erb" => "Fancy <%= yield %>",
55
+ "explicit_layout/index.html.erb" => "explicit layout index"
56
+ )]
57
+ Rails.application.routes.draw do
58
+ get 'explicit_layout', to: 'explicit_layout#index'
59
+ end
60
+ end
61
+ it "should use explicit layout for unmatched store" do
62
+ get "http://www.example.com/explicit_layout"
63
+ expect(response.body).to eq("Fancy explicit layout index")
64
+ end
65
+ it "should use explicit layout for the current store" do
66
+ get "http://#{store.url}/explicit_layout"
67
+ expect(response.body).to eq("Fancy explicit layout index")
68
+ end
69
+ end
44
70
  end
@@ -10,6 +10,7 @@ require 'ffaker'
10
10
 
11
11
  # Requires factories defined in spree_core
12
12
  require 'spree/testing_support/factories'
13
+ require 'spree_multi_domain/testing_support/factory_overrides'
13
14
  require 'spree/testing_support/controller_requests'
14
15
  require 'spree/testing_support/authorization_helpers'
15
16
  require 'spree/testing_support/preferences'
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_multi_domain
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-25 00:00:00.000000000 Z
11
+ date: 2016-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus
@@ -221,6 +221,7 @@ files:
221
221
  - lib/spree/search/multi_domain.rb
222
222
  - lib/spree_multi_domain/engine.rb
223
223
  - lib/spree_multi_domain/multi_domain_helpers.rb
224
+ - lib/spree_multi_domain/testing_support/factory_overrides.rb
224
225
  - solidus_multi_domain.gemspec
225
226
  - spec/controllers/spree/admin/products_controller_spec.rb
226
227
  - spec/controllers/spree/admin/stores_controller_spec.rb
@@ -229,6 +230,7 @@ files:
229
230
  - spec/controllers/spree/api/shipments_controller_spec.rb
230
231
  - spec/controllers/spree/products_controller_spec.rb
231
232
  - spec/helpers/products_helper_decorator_spec.rb
233
+ - spec/lib/spree_multi_domain/testing_support/factory_overrides_spec.rb
232
234
  - spec/models/spree/line_item_spec.rb
233
235
  - spec/models/spree/order_spec.rb
234
236
  - spec/models/spree/permission_sets/store_display_spec.rb
@@ -241,7 +243,7 @@ files:
241
243
  - spec/requests/global_controller_helpers_spec.rb
242
244
  - spec/requests/template_renderer_spec.rb
243
245
  - spec/spec_helper.rb
244
- - spec/support/factory_overrides.rb
246
+ - spec/support/.gitkeep
245
247
  homepage: https://solidus.io
246
248
  licenses:
247
249
  - BSD-3
@@ -275,6 +277,7 @@ test_files:
275
277
  - spec/controllers/spree/api/shipments_controller_spec.rb
276
278
  - spec/controllers/spree/products_controller_spec.rb
277
279
  - spec/helpers/products_helper_decorator_spec.rb
280
+ - spec/lib/spree_multi_domain/testing_support/factory_overrides_spec.rb
278
281
  - spec/models/spree/line_item_spec.rb
279
282
  - spec/models/spree/order_spec.rb
280
283
  - spec/models/spree/permission_sets/store_display_spec.rb
@@ -287,4 +290,4 @@ test_files:
287
290
  - spec/requests/global_controller_helpers_spec.rb
288
291
  - spec/requests/template_renderer_spec.rb
289
292
  - spec/spec_helper.rb
290
- - spec/support/factory_overrides.rb
293
+ - spec/support/.gitkeep