solidus_frontend 2.2.2 → 2.3.0.beta1

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f80a15237e018ec72f6f3c37732bf4b48791274f
4
- data.tar.gz: '05953613a4aae475826ac05522df13be3a0215e6'
3
+ metadata.gz: f61c60cecfffed07245862d52b42fd39e3de5738
4
+ data.tar.gz: e8c835cdbc995bdfd5a57b2659b991f9365e844f
5
5
  SHA512:
6
- metadata.gz: 78f0d29ec7da1e242f51b99252446fd8ba8fd413ba5b6e3f7a0bfa9fbc4c4b87fb7d0c3d22519bf025313b55ac23509242ce8383aa3d71a81406f03a8142a965
7
- data.tar.gz: 3cb69bb1575f3419018b6fff0cb0ce05622e2a10c79891a02d694432835257633ddab5b19fbbb5e5280b61bcc7eba166e419bf5ece5427fe6ea640ad00eee4c7
6
+ metadata.gz: 77d3a4a03b9097a2746e0694ecacb40e0b74aa44adc8821da3af032013de92de413df78a7ed6e3db33742190f963892c6ba11ec0d9f9cb5ee01e9587c7243906
7
+ data.tar.gz: 2be95640b389be196abb5dfba472a9e68d85e99235fac7be0e960d94b5c91f8189afcf75b99156c2a2a471d8211deaa9891fbf1aec394f6080bc9951d2c17471
@@ -6,18 +6,18 @@ Spree.onCouponCodeApply = (e) ->
6
6
  couponStatus = $("#coupon_status")
7
7
  successClass = 'success'
8
8
  errorClass = 'alert'
9
- url = Spree.url(Spree.routes.apply_coupon_code(Spree.current_order_id),
10
- {
11
- order_token: Spree.current_order_token,
12
- coupon_code: couponCode
13
- }
14
- )
15
9
 
16
10
  couponStatus.removeClass([successClass,errorClass].join(" "))
17
11
 
12
+ data =
13
+ order_token: Spree.current_order_token,
14
+ coupon_code: couponCode
15
+
18
16
  req = Spree.ajax
19
- method: "PUT",
20
- url: url
17
+ method: "PUT"
18
+ url: Spree.routes.apply_coupon_code(Spree.current_order_id)
19
+ data: JSON.stringify(data)
20
+ contentType: "application/json"
21
21
 
22
22
  req.done (data) ->
23
23
  window.location.reload()
@@ -401,8 +401,8 @@ nav#taxonomies {
401
401
  }
402
402
 
403
403
  .errorExplanation {
404
- @extend .flash.error;
405
404
  @extend .flash;
405
+ background-color: $c_red;
406
406
 
407
407
  p {
408
408
  font-weight: normal;
@@ -450,13 +450,18 @@ nav#taxonomies {
450
450
  }
451
451
  }
452
452
 
453
- span.price {
453
+ %price_text {
454
454
  font-weight: bold;
455
455
  color: $link_text_color;
456
+ }
457
+
458
+ span.price {
459
+ @extend %price_text;
456
460
 
457
461
  &.selling {
458
462
  font-size: $product_detail_price_font_size;
459
463
  }
464
+
460
465
  &.diff {
461
466
  font-weight: bold;
462
467
  }
@@ -715,7 +720,7 @@ ul#products {
715
720
  tr[data-hook="item_total"] {
716
721
  td:last-child {
717
722
  strong {
718
- @extend span.price;
723
+ @extend %price_text;;
719
724
  }
720
725
  }
721
726
  }
@@ -725,7 +730,7 @@ ul#products {
725
730
  };
726
731
 
727
732
  #summary-order-total {
728
- @extend span.price;
733
+ @extend %price_text;;
729
734
  font-size: $base_font_size + 2;
730
735
  }
731
736
  }
@@ -772,7 +777,7 @@ ul#products {
772
777
 
773
778
  td.price, td.total {
774
779
  span {
775
- @extend span.price;
780
+ @extend %price_text;;
776
781
  }
777
782
  }
778
783
 
@@ -947,8 +952,8 @@ table#cart-detail {
947
952
  tr {
948
953
 
949
954
  td[data-hook="cart_item_price"], td[data-hook="cart_item_total"] {
950
- @extend span.price;
951
- @extend span.price.selling;
955
+ @extend %price_text;
956
+ font-size: $product_detail_price_font_size;
952
957
  }
953
958
  td[data-hook="cart_item_quantity"] {
954
959
  .line_item_quantity {
@@ -977,7 +982,7 @@ div[data-hook="inside_cart_form"] {
977
982
  margin-top: 15px;
978
983
 
979
984
  span.order-total {
980
- @extend span.price;
985
+ @extend %price_text;
981
986
  }
982
987
  }
983
988
  }
@@ -171,8 +171,9 @@ module Spree
171
171
  end
172
172
 
173
173
  def before_address
174
- # if the user has a default address, a callback takes care of setting
175
- # that; but if he doesn't, we need to build an empty one here
174
+ @order.assign_default_user_addresses
175
+ # If the user has a default address, the previous method call takes care
176
+ # of setting that; but if he doesn't, we need to build an empty one here
176
177
  default = {country_id: Spree::Country.default.id}
177
178
  @order.build_bill_address(default) unless @order.bill_address
178
179
  @order.build_ship_address(default) if @order.checkout_steps.include?('delivery') && !@order.ship_address
@@ -13,7 +13,7 @@ module Spree
13
13
  skip_before_action :verify_authenticity_token, only: [:populate]
14
14
 
15
15
  def show
16
- @order = Spree::Order.find_by_number!(params[:id])
16
+ @order = Spree::Order.find_by!(number: params[:id])
17
17
  end
18
18
 
19
19
  def update
@@ -44,7 +44,7 @@ module Spree
44
44
  def populate
45
45
  @order = current_order(create_order_if_necessary: true)
46
46
  variant = Spree::Variant.find(params[:variant_id])
47
- quantity = params[:quantity].to_i
47
+ quantity = params[:quantity].present? ? params[:quantity].to_i : 1
48
48
 
49
49
  # 2,147,483,647 is crazy. See issue https://github.com/spree/spree/issues/2695.
50
50
  if !quantity.between?(1, 2_147_483_647)
@@ -93,7 +93,7 @@ module Spree
93
93
 
94
94
  def check_authorization
95
95
  cookies.permanent.signed[:guest_token] = params[:token] if params[:token]
96
- order = Spree::Order.find_by_number(params[:id]) || current_order
96
+ order = Spree::Order.find_by(number: params[:id]) || current_order
97
97
 
98
98
  if order
99
99
  authorize! :edit, order, cookies.signed[:guest_token]
@@ -11,7 +11,7 @@ module Spree
11
11
 
12
12
  def cart_link
13
13
  render partial: 'spree/shared/link_to_cart'
14
- fresh_when(simple_current_order, template: 'spree/shared/_link_to_cart')
14
+ fresh_when(current_order, template: 'spree/shared/_link_to_cart')
15
15
  end
16
16
 
17
17
  private
@@ -6,7 +6,7 @@ module Spree
6
6
  respond_to :html
7
7
 
8
8
  def show
9
- @taxon = Spree::Taxon.find_by_permalink!(params[:id])
9
+ @taxon = Spree::Taxon.find_by!(permalink: params[:id])
10
10
  return unless @taxon
11
11
 
12
12
  @searcher = build_searcher(params.merge(taxon: @taxon.id, include_images: true))
@@ -21,7 +21,7 @@
21
21
  <% @wallet_payment_sources.each do |wallet_payment_source| %>
22
22
  <%=
23
23
  render(
24
- partial: "spree/checkout/existing_payment/#{wallet_payment_source.payment_source.payment_method.method_type}",
24
+ partial: "spree/checkout/existing_payment/#{wallet_payment_source.payment_source.payment_method.partial_name}",
25
25
  locals: {
26
26
  wallet_payment_source: wallet_payment_source,
27
27
  default: wallet_payment_source == @default_wallet_payment_source,
@@ -50,7 +50,7 @@
50
50
  <% @order.available_payment_methods.each do |method| %>
51
51
  <li id="payment_method_<%= method.id %>" class="<%= 'last' if method == @order.available_payment_methods.last %>" data-hook>
52
52
  <fieldset>
53
- <%= render partial: "spree/checkout/payment/#{method.method_type}", locals: { payment_method: method } %>
53
+ <%= render partial: "spree/checkout/payment/#{method.partial_name}", locals: { payment_method: method } %>
54
54
  </fieldset>
55
55
  </li>
56
56
  <% end %>
@@ -34,7 +34,7 @@
34
34
  <div id="product-price">
35
35
  <h6 class="product-section-title"><%= Spree.t(:price) %></h6>
36
36
  <div>
37
- <span class="price selling" itemprop="price">
37
+ <span class="price selling" itemprop="price" content="<%= @product.price_for(current_pricing_options).to_d %>">
38
38
  <%= display_price(@product) %>
39
39
  </span>
40
40
  <span itemprop="priceCurrency" content="<%= current_pricing_options.currency %>"></span>
@@ -32,7 +32,10 @@
32
32
  </div>
33
33
  <%= link_to truncate(product.name, length: 50), url, class: 'info', itemprop: "name", title: product.name %>
34
34
  <span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
35
- <span class="price selling" itemprop="price"><%= display_price(product) %></span>
35
+ <span class="price selling" itemprop="price" content="<%= product.price_for(current_pricing_options).to_d %>">
36
+ <%= display_price(product) %>
37
+ </span>
38
+ <span itemprop="priceCurrency" content="<%= current_pricing_options.currency %>"></span>
36
39
  </span>
37
40
  <% end %>
38
41
  </li>
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency 'solidus_api', s.version
25
25
  s.add_dependency 'solidus_core', s.version
26
26
 
27
- s.add_dependency 'canonical-rails', '~> 0.1.1'
27
+ s.add_dependency 'canonical-rails', '~> 0.2.0'
28
28
  s.add_dependency 'jquery-rails'
29
29
  s.add_dependency 'sass-rails'
30
30
  s.add_dependency 'coffee-rails'
@@ -81,9 +81,9 @@ describe Spree::CheckoutController, type: :controller do
81
81
  }
82
82
  end
83
83
 
84
- let!(:payment_method) { create(:payment_method) }
85
84
  before do
86
85
  # Must have *a* shipping method and a payment method so updating from address works
86
+ allow(order).to receive_messages available_payment_methods: [stub_model(Spree::PaymentMethod)]
87
87
  allow(order).to receive_messages ensure_available_shipping_rates: true
88
88
  order.line_items << FactoryGirl.create(:line_item)
89
89
  end
@@ -143,6 +143,13 @@ describe Spree::CheckoutController, type: :controller do
143
143
  order.update_columns(ship_address_id: create(:address).id, state: "address")
144
144
  end
145
145
 
146
+ context 'landing to address page' do
147
+ it "tries to associate user addresses to order" do
148
+ expect(order).to receive(:assign_default_user_addresses)
149
+ get :edit
150
+ end
151
+ end
152
+
146
153
  context "with a billing and shipping address" do
147
154
  subject do
148
155
  post :update, params: {
@@ -218,53 +225,6 @@ describe Spree::CheckoutController, type: :controller do
218
225
  end
219
226
  end
220
227
 
221
- context "when in the payment state" do
222
- let(:order) { create(:order_with_line_items) }
223
- let(:payment_method) { create(:credit_card_payment_method) }
224
-
225
- let(:params) do
226
- {
227
- state: 'payment',
228
- order: {
229
- payments_attributes: [
230
- {
231
- payment_method_id: payment_method.id.to_s,
232
- source_attributes: attributes_for(:credit_card)
233
- }
234
- ]
235
- }
236
- }
237
- end
238
-
239
- before do
240
- order.update_attributes! user: user
241
- 3.times { order.next! } # should put us in the payment state
242
- end
243
-
244
- context 'with a permitted payment method' do
245
- it 'sets the payment amount' do
246
- post :update, params: params
247
- order.reload
248
- expect(order.state).to eq('confirm')
249
- expect(order.payments.size).to eq(1)
250
- expect(order.payments.first.amount).to eq(order.total)
251
- end
252
- end
253
-
254
- context 'with an unpermitted payment method' do
255
- before { payment_method.update!(available_to_users: false) }
256
-
257
- it 'sets the payment amount' do
258
- expect {
259
- post :update, params: params
260
- }.to raise_error(ActiveRecord::RecordNotFound)
261
-
262
- expect(order.state).to eq('payment')
263
- expect(order.payments).to be_empty
264
- end
265
- end
266
- end
267
-
268
228
  context "when in the confirm state" do
269
229
  before do
270
230
  order.update_attributes! user: user
@@ -370,39 +330,18 @@ describe Spree::CheckoutController, type: :controller do
370
330
  expect(response).to redirect_to(spree.checkout_state_path('address'))
371
331
  end
372
332
  end
373
- end
374
-
375
- context "fails to transition to complete from confirm" do
376
- let(:order) do
377
- FactoryGirl.create(:order_with_line_items).tap(&:next!)
378
- end
379
-
380
- before do
381
- allow(controller).to receive_messages current_order: order
382
- allow(controller).to receive_messages check_authorization: true
383
- end
384
333
 
385
334
  context "when the country is not a shippable country" do
386
- before do
387
- order.ship_address.tap do |address|
388
- # A different country which is not included in the list of shippable countries
389
- australia = create(:country, name: "Australia")
390
- # update_columns to get around readonly restriction when testing
391
- address.update_columns(country_id: australia.id, state_name: 'Victoria')
392
- end
335
+ let(:foreign_address) { create(:address, country_iso_code: "CA") }
393
336
 
394
- payment_method = FactoryGirl.create(:simple_credit_card_payment_method)
395
- payment = FactoryGirl.create(:payment, payment_method: payment_method)
396
- order.payments << payment
337
+ before do
338
+ order.update(shipping_address: foreign_address)
397
339
  end
398
340
 
399
341
  it "due to no available shipping rates for any of the shipments" do
400
- expect(order.shipments.count).to eq(1)
401
- order.shipments.first.shipping_rates.delete_all
402
- order.update_attributes(state: 'confirm')
403
- put :update, params: { state: order.state, order: {} }
342
+ put :update, params: { state: "address", order: {} }
404
343
  expect(flash[:error]).to eq(Spree.t(:items_cannot_be_shipped))
405
- expect(response).to redirect_to(spree.checkout_state_path('confirm'))
344
+ expect(response).to redirect_to(spree.checkout_state_path('address'))
406
345
  end
407
346
  end
408
347
  end
@@ -458,7 +397,7 @@ describe Spree::CheckoutController, type: :controller do
458
397
  end
459
398
 
460
399
  it "should set flash message for no inventory" do
461
- expect(flash[:error]).to eq(Spree.t(:inventory_error_flash_for_insufficient_quantity, names: "'#{product.name}'" ))
400
+ expect(flash[:error]).to eq("Amazing Item became unavailable.")
462
401
  end
463
402
  end
464
403
  end
@@ -19,7 +19,7 @@ describe Spree::OrdersController, type: :controller do
19
19
  post :populate
20
20
  expect(cookies.signed[:guest_token]).not_to be_blank
21
21
 
22
- order_by_token = Spree::Order.find_by_guest_token(cookies.signed[:guest_token])
22
+ order_by_token = Spree::Order.find_by(guest_token: cookies.signed[:guest_token])
23
23
  assigned_order = assigns[:order]
24
24
 
25
25
  expect(assigned_order).to eq order_by_token
@@ -68,6 +68,34 @@ describe Spree::OrdersController, type: :controller do
68
68
  Spree.t(:please_enter_reasonable_quantity)
69
69
  )
70
70
  end
71
+
72
+ context "when quantity is empty string" do
73
+ it "should populate order with 1 of given variant" do
74
+ expect do
75
+ post :populate, params: { variant_id: variant.id, quantity: '' }
76
+ end.to change { Spree::Order.count }.by(1)
77
+ order = Spree::Order.last
78
+ expect(response).to redirect_to spree.cart_path
79
+ expect(order.line_items.size).to eq(1)
80
+ line_item = order.line_items.first
81
+ expect(line_item.variant_id).to eq(variant.id)
82
+ expect(line_item.quantity).to eq(1)
83
+ end
84
+ end
85
+
86
+ context "when quantity is nil" do
87
+ it "should populate order with 1 of given variant" do
88
+ expect do
89
+ post :populate, params: { variant_id: variant.id, quantity: nil }
90
+ end.to change { Spree::Order.count }.by(1)
91
+ order = Spree::Order.last
92
+ expect(response).to redirect_to spree.cart_path
93
+ expect(order.line_items.size).to eq(1)
94
+ line_item = order.line_items.first
95
+ expect(line_item.variant_id).to eq(variant.id)
96
+ expect(line_item.quantity).to eq(1)
97
+ end
98
+ end
71
99
  end
72
100
  end
73
101
 
@@ -75,11 +75,145 @@ describe "Checkout", type: :feature, inaccessible: true do
75
75
  end
76
76
  end
77
77
 
78
+ context "displays default user addresses on address step" do
79
+ before do
80
+ stock_location.stock_items.update_all(count_on_hand: 1)
81
+ end
82
+
83
+ context "when user is logged in" do
84
+ let!(:user) do
85
+ create(:user, bill_address: saved_bill_address, ship_address: saved_ship_address)
86
+ end
87
+
88
+ let!(:order) do
89
+ order = Spree::Order.create!(
90
+ email: "spree@example.com",
91
+ store: Spree::Store.first || FactoryGirl.create(:store)
92
+ )
93
+
94
+ order.reload
95
+ order.user = user
96
+ order.update!
97
+ order
98
+ end
99
+
100
+ before do
101
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
102
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
103
+ allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
104
+
105
+ add_mug_to_cart
106
+ click_button "Checkout"
107
+ # We need an order reload here to get newly associated addresses.
108
+ # Then we go back to address where we are supposed to be redirected.
109
+ order.reload
110
+ visit spree.checkout_state_path(:address)
111
+ end
112
+
113
+ context "when user has default addresses saved" do
114
+ let(:saved_bill_address) { create(:address, firstname: 'Bill') }
115
+ let(:saved_ship_address) { create(:address, firstname: 'Steve') }
116
+
117
+ it "shows the saved addresses" do
118
+ within("#billing") do
119
+ expect(find_field('First Name').value).to eq 'Bill'
120
+ end
121
+
122
+ within("#shipping") do
123
+ expect(find_field('First Name').value).to eq 'Steve'
124
+ end
125
+ end
126
+ end
127
+
128
+ context "when user does not have default addresses saved" do
129
+ let(:saved_bill_address) { nil }
130
+ let(:saved_ship_address) { nil }
131
+
132
+ it 'shows an empty address' do
133
+ within("#billing") do
134
+ expect(find_field('First Name').value).to be_nil
135
+ end
136
+
137
+ within("#shipping") do
138
+ expect(find_field('First Name').value).to be_nil
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ context "when user is not logged in" do
145
+ context "and proceeds with guest checkout" do
146
+ it 'shows empty addresses' do
147
+ add_mug_to_cart
148
+ click_button "Checkout"
149
+
150
+ within("#billing") do
151
+ expect(find_field('First Name').value).to be_nil
152
+ end
153
+
154
+ within("#shipping") do
155
+ expect(find_field('First Name').value).to be_nil
156
+ end
157
+ end
158
+ end
159
+
160
+ context "and proceeds logging in" do
161
+ let!(:user) do
162
+ create(:user, bill_address: saved_bill_address, ship_address: saved_ship_address)
163
+ end
164
+
165
+ before do
166
+ add_mug_to_cart
167
+ click_button "Checkout"
168
+
169
+ # Simulate user login
170
+ Spree::Order.last.associate_user!(user)
171
+ allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
172
+ allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
173
+
174
+ # Simulate redirect back to address after login
175
+ visit spree.checkout_state_path(:address)
176
+ end
177
+
178
+ context "when does not have saved addresses" do
179
+ let(:saved_bill_address) { nil }
180
+ let(:saved_ship_address) { nil }
181
+
182
+ it 'shows empty addresses' do
183
+ within("#billing") do
184
+ expect(find_field('First Name').value).to be_nil
185
+ end
186
+
187
+ within("#shipping") do
188
+ expect(find_field('First Name').value).to be_nil
189
+ end
190
+ end
191
+ end
192
+
193
+ # Regression test for https://github.com/solidusio/solidus/issues/1811
194
+ context "when does have saved addresses" do
195
+ let(:saved_bill_address) { create(:address, firstname: 'Bill') }
196
+ let(:saved_ship_address) { create(:address, firstname: 'Steve') }
197
+
198
+ it 'shows empty addresses' do
199
+ within("#billing") do
200
+ expect(find_field('First Name').value).to eq 'Bill'
201
+ end
202
+
203
+ within("#shipping") do
204
+ expect(find_field('First Name').value).to eq 'Steve'
205
+ end
206
+ end
207
+ end
208
+ end
209
+ end
210
+ end
211
+
78
212
  # Regression test for https://github.com/spree/spree/issues/2694 and https://github.com/spree/spree/issues/4117
79
213
  context "doesn't allow bad credit card numbers" do
80
- let!(:payment_method) { create(:credit_card_payment_method) }
81
214
  before(:each) do
82
215
  order = OrderWalkthrough.up_to(:delivery)
216
+ allow(order).to receive_messages(available_payment_methods: [create(:credit_card_payment_method)])
83
217
 
84
218
  user = create(:user)
85
219
  order.user = user
@@ -180,8 +314,7 @@ describe "Checkout", type: :feature, inaccessible: true do
180
314
  end
181
315
 
182
316
  context "user has payment sources", js: true do
183
- before { Spree::PaymentMethod.all.each(&:really_destroy!) }
184
- let!(:bogus) { create(:credit_card_payment_method) }
317
+ let(:bogus) { create(:credit_card_payment_method) }
185
318
  let(:user) { create(:user) }
186
319
 
187
320
  let!(:credit_card) do
@@ -191,6 +324,7 @@ describe "Checkout", type: :feature, inaccessible: true do
191
324
  before do
192
325
  user.wallet.add(credit_card)
193
326
  order = OrderWalkthrough.up_to(:delivery)
327
+ allow(order).to receive_messages(available_payment_methods: [bogus])
194
328
 
195
329
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
196
330
  allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
@@ -36,7 +36,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
36
36
  end
37
37
 
38
38
  describe 'meta tags and title' do
39
- let(:jersey) { Spree::Product.find_by_name('Ruby on Rails Baseball Jersey') }
39
+ let(:jersey) { Spree::Product.find_by(name: 'Ruby on Rails Baseball Jersey') }
40
40
  let(:metas) { { meta_description: 'Brand new Ruby on Rails Jersey', meta_title: 'Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel', meta_keywords: 'ror, jersey, ruby' } }
41
41
 
42
42
  it 'should return the correct title when displaying a single product' do
@@ -78,13 +78,25 @@ describe "Visiting Products", type: :feature, inaccessible: true do
78
78
  end
79
79
  end
80
80
 
81
+ describe 'schema.org markup' do
82
+ let(:product) { Spree::Product.available.first }
83
+
84
+ it 'has correct schema.org/Offer attributes' do
85
+ expect(page).to have_css("#product_#{product.id} [itemprop='price'][content='19.99']")
86
+ expect(page).to have_css("#product_#{product.id} [itemprop='priceCurrency'][content='USD']")
87
+ click_link product.name
88
+ expect(page).to have_css("[itemprop='price'][content='19.99']")
89
+ expect(page).to have_css("[itemprop='priceCurrency'][content='USD']")
90
+ end
91
+ end
92
+
81
93
  context "using Russian Rubles as a currency" do
82
94
  before do
83
95
  Spree::Config[:currency] = "RUB"
84
96
  end
85
97
 
86
98
  let!(:product) do
87
- product = Spree::Product.find_by_name("Ruby on Rails Ringer T-Shirt")
99
+ product = Spree::Product.find_by(name: "Ruby on Rails Ringer T-Shirt")
88
100
  product.price = 19.99
89
101
  product.tap(&:save)
90
102
  end
@@ -135,7 +147,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
135
147
  end
136
148
 
137
149
  context "a product with variants" do
138
- let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
150
+ let(:product) { Spree::Product.find_by(name: "Ruby on Rails Baseball Jersey") }
139
151
  let(:option_value) { create(:option_value) }
140
152
  let!(:variant) { product.variants.create!(price: 5.59) }
141
153
 
@@ -168,7 +180,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
168
180
  end
169
181
 
170
182
  context "a product with variants, images only for the variants" do
171
- let(:product) { Spree::Product.find_by_name("Ruby on Rails Baseball Jersey") }
183
+ let(:product) { Spree::Product.find_by(name: "Ruby on Rails Baseball Jersey") }
172
184
 
173
185
  before do
174
186
  image = File.open(File.expand_path('../../fixtures/thinking-cat.jpg', __FILE__))
@@ -258,7 +270,7 @@ describe "Visiting Products", type: :feature, inaccessible: true do
258
270
  end
259
271
 
260
272
  it "should return the correct title when displaying a single product" do
261
- product = Spree::Product.find_by_name("Ruby on Rails Baseball Jersey")
273
+ product = Spree::Product.find_by(name: "Ruby on Rails Baseball Jersey")
262
274
  click_link product.name
263
275
 
264
276
  within("div#product-description") do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-12 00:00:00.000000000 Z
11
+ date: 2017-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_api
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.2
19
+ version: 2.3.0.beta1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.2.2
26
+ version: 2.3.0.beta1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: solidus_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.2
33
+ version: 2.3.0.beta1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.2.2
40
+ version: 2.3.0.beta1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: canonical-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.1
47
+ version: 0.2.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.1
54
+ version: 0.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: jquery-rails
57
57
  requirement: !ruby/object:Gem::Requirement