spree_auth_devise 3.2.0.beta → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +17 -6
  3. data/.travis.yml +19 -7
  4. data/Appraisals +13 -0
  5. data/CHANGELOG.md +11 -3
  6. data/Gemfile +1 -0
  7. data/README.md +30 -27
  8. data/Rakefile +1 -1
  9. data/app/mailers/spree/user_mailer.rb +6 -6
  10. data/app/models/spree/auth_configuration.rb +3 -3
  11. data/app/models/spree/user.rb +17 -16
  12. data/app/overrides/auth_shared_login_bar.rb +6 -7
  13. data/config.ru +1 -1
  14. data/config/initializers/devise.rb +1 -1
  15. data/config/initializers/warden.rb +2 -2
  16. data/config/locales/bg.yml +54 -0
  17. data/config/locales/de.yml +1 -1
  18. data/config/locales/en.yml +1 -1
  19. data/config/locales/es.yml +1 -1
  20. data/config/locales/fr.yml +1 -1
  21. data/config/locales/it.yml +2 -2
  22. data/config/locales/nl.yml +1 -1
  23. data/config/locales/pt-BR.yml +1 -1
  24. data/config/locales/pt.yml +1 -1
  25. data/config/locales/tr.yml +1 -1
  26. data/config/routes.rb +17 -18
  27. data/db/default/users.rb +6 -6
  28. data/db/migrate/20101026184949_create_users.rb +14 -9
  29. data/db/migrate/20101026184950_rename_columns_for_devise.rb +6 -1
  30. data/db/migrate/20101214150824_convert_user_remember_field.rb +6 -1
  31. data/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb +6 -1
  32. data/db/migrate/20120605211305_make_users_email_index_unique.rb +8 -3
  33. data/db/migrate/20140904000425_add_deleted_at_to_users.rb +6 -1
  34. data/db/migrate/20141002154641_add_confirmable_to_users.rb +6 -1
  35. data/db/migrate/20150416152553_add_missing_indices_on_user.rb +6 -1
  36. data/gemfiles/spree_3_1.gemfile +7 -0
  37. data/gemfiles/spree_3_2.gemfile +8 -0
  38. data/gemfiles/spree_master.gemfile +8 -0
  39. data/lib/controllers/backend/spree/admin/admin_controller_decorator.rb +6 -8
  40. data/lib/controllers/backend/spree/admin/admin_orders_controller_decorator.rb +15 -14
  41. data/lib/controllers/backend/spree/admin/admin_resource_controller_decorator.rb +1 -1
  42. data/lib/controllers/backend/spree/admin/orders/customer_details_controller_decorator.rb +9 -8
  43. data/lib/controllers/backend/spree/admin/user_passwords_controller.rb +6 -1
  44. data/lib/controllers/backend/spree/admin/user_sessions_controller.rb +22 -16
  45. data/lib/controllers/frontend/spree/checkout_controller_decorator.rb +17 -16
  46. data/lib/controllers/frontend/spree/user_confirmations_controller.rb +4 -0
  47. data/lib/controllers/frontend/spree/user_passwords_controller.rb +5 -1
  48. data/lib/controllers/frontend/spree/user_registrations_controller.rb +4 -0
  49. data/lib/controllers/frontend/spree/user_sessions_controller.rb +18 -11
  50. data/lib/controllers/frontend/spree/users_controller.rb +16 -15
  51. data/lib/generators/spree/auth/install/install_generator.rb +8 -2
  52. data/lib/spree/auth/devise.rb +1 -1
  53. data/lib/spree/auth/engine.rb +9 -9
  54. data/lib/tasks/auth.rake +1 -1
  55. data/lib/views/frontend/spree/users/show.html.erb +1 -1
  56. data/spec/controllers/spree/checkout_controller_spec.rb +1 -2
  57. data/spec/controllers/spree/products_controller_spec.rb +0 -1
  58. data/spec/controllers/spree/user_passwords_controller_spec.rb +3 -4
  59. data/spec/controllers/spree/user_registrations_controller_spec.rb +0 -1
  60. data/spec/controllers/spree/user_sessions_controller_spec.rb +0 -1
  61. data/spec/controllers/spree/users_controller_spec.rb +0 -1
  62. data/spec/factories/confirmed_user.rb +1 -1
  63. data/spec/features/account_spec.rb +0 -1
  64. data/spec/features/admin/orders_spec.rb +0 -1
  65. data/spec/features/admin/password_reset_spec.rb +0 -1
  66. data/spec/features/admin/products_spec.rb +0 -1
  67. data/spec/features/admin/sign_in_spec.rb +0 -1
  68. data/spec/features/admin/sign_out_spec.rb +0 -1
  69. data/spec/features/admin_permissions_spec.rb +0 -1
  70. data/spec/features/change_email_spec.rb +0 -1
  71. data/spec/features/checkout_spec.rb +8 -8
  72. data/spec/features/confirmation_spec.rb +1 -1
  73. data/spec/features/order_spec.rb +0 -1
  74. data/spec/features/password_reset_spec.rb +0 -1
  75. data/spec/features/sign_in_spec.rb +1 -2
  76. data/spec/features/sign_out_spec.rb +0 -1
  77. data/spec/features/sign_up_spec.rb +0 -1
  78. data/spec/mailers/user_mailer_spec.rb +0 -1
  79. data/spec/models/order_spec.rb +0 -1
  80. data/spec/models/user_spec.rb +3 -1
  81. data/spec/spec_helper.rb +0 -7
  82. data/spec/support/ability.rb +1 -1
  83. data/spec/support/authentication_helpers.rb +2 -2
  84. data/spec/support/capybara.rb +1 -1
  85. data/spec/support/confirm_helpers.rb +1 -1
  86. data/spec/support/database_cleaner.rb +2 -3
  87. data/spec/support/spree.rb +0 -16
  88. data/spree_auth_devise.gemspec +6 -6
  89. metadata +16 -13
  90. data/Versionfile +0 -5
  91. data/circle.yml +0 -13
@@ -18,23 +18,24 @@ Spree::CheckoutController.class_eval do
18
18
  end
19
19
 
20
20
  private
21
- def order_params
22
- params[:order] ? params.require(:order).permit(:email) : {}
23
- end
24
21
 
25
- def skip_state_validation?
26
- %w(registration update_registration).include?(params[:action])
27
- end
22
+ def order_params
23
+ params[:order].present? ? params.require(:order).permit(:email) : {}
24
+ end
28
25
 
29
- def check_authorization
30
- authorize!(:edit, current_order, cookies.signed[:guest_token])
31
- end
26
+ def skip_state_validation?
27
+ %w(registration update_registration).include?(params[:action])
28
+ end
32
29
 
33
- # Introduces a registration step whenever the +registration_step+ preference is true.
34
- def check_registration
35
- return unless Spree::Auth::Config[:registration_step]
36
- return if spree_current_user or current_order.email
37
- store_location
38
- redirect_to spree.checkout_registration_path
39
- end
30
+ def check_authorization
31
+ authorize!(:edit, current_order, cookies.signed[:guest_token])
32
+ end
33
+
34
+ # Introduces a registration step whenever the +registration_step+ preference is true.
35
+ def check_registration
36
+ return unless Spree::Auth::Config[:registration_step]
37
+ return if spree_current_user || current_order.email
38
+ store_location
39
+ redirect_to spree.checkout_registration_path
40
+ end
40
41
  end
@@ -11,4 +11,8 @@ class Spree::UserConfirmationsController < Devise::ConfirmationsController
11
11
  def after_confirmation_path_for(resource_name, resource)
12
12
  signed_in?(resource_name) ? signed_in_root_path(resource) : spree.login_path
13
13
  end
14
+
15
+ def translation_scope
16
+ 'devise.confirmations'
17
+ end
14
18
  end
@@ -18,7 +18,7 @@ class Spree::UserPasswordsController < Devise::PasswordsController
18
18
 
19
19
  if resource.errors.empty?
20
20
  set_flash_message(:notice, :send_instructions) if is_navigational_format?
21
- respond_with resource, :location => spree.login_path
21
+ respond_with resource, location: spree.login_path
22
22
  else
23
23
  respond_with_navigational(resource) { render :new }
24
24
  end
@@ -40,6 +40,10 @@ class Spree::UserPasswordsController < Devise::PasswordsController
40
40
 
41
41
  protected
42
42
 
43
+ def translation_scope
44
+ 'devise.user_passwords'
45
+ end
46
+
43
47
  def new_session_path(resource_name)
44
48
  spree.send("new_#{resource_name}_session_path")
45
49
  end
@@ -67,6 +67,10 @@ class Spree::UserRegistrationsController < Devise::RegistrationsController
67
67
  authorize!(:create, resource)
68
68
  end
69
69
 
70
+ def translation_scope
71
+ 'devise.user_registrations'
72
+ end
73
+
70
74
  private
71
75
 
72
76
  def spree_user_params
@@ -16,9 +16,9 @@ class Spree::UserSessionsController < Devise::SessionsController
16
16
  redirect_back_or_default(after_sign_in_path_for(spree_current_user))
17
17
  }
18
18
  format.js {
19
- render :json => {:user => spree_current_user,
20
- :ship_address => spree_current_user.ship_address,
21
- :bill_address => spree_current_user.bill_address}.to_json
19
+ render json: { user: spree_current_user,
20
+ ship_address: spree_current_user.ship_address,
21
+ bill_address: spree_current_user.bill_address }.to_json
22
22
  }
23
23
  end
24
24
  else
@@ -28,19 +28,26 @@ class Spree::UserSessionsController < Devise::SessionsController
28
28
  render :new
29
29
  }
30
30
  format.js {
31
- render :json => { error: t('devise.failure.invalid') }, status: :unprocessable_entity
31
+ render json: { error: t('devise.failure.invalid') }, status: :unprocessable_entity
32
32
  }
33
33
  end
34
34
  end
35
35
  end
36
36
 
37
+ protected
38
+
39
+ def translation_scope
40
+ 'devise.user_sessions'
41
+ end
42
+
37
43
  private
38
- def accurate_title
39
- Spree.t(:login)
40
- end
41
44
 
42
- def redirect_back_or_default(default)
43
- redirect_to(session["spree_user_return_to"] || default)
44
- session["spree_user_return_to"] = nil
45
- end
45
+ def accurate_title
46
+ Spree.t(:login)
47
+ end
48
+
49
+ def redirect_back_or_default(default)
50
+ redirect_to(session["spree_user_return_to"] || default)
51
+ session["spree_user_return_to"] = nil
52
+ end
46
53
  end
@@ -28,29 +28,30 @@ class Spree::UsersController < Spree::StoreController
28
28
  if params[:user][:password].present?
29
29
  # this logic needed b/c devise wants to log us out after password changes
30
30
  user = Spree::User.reset_password_by_token(params[:user])
31
- sign_in(@user, :event => :authentication, :bypass => !Spree::Auth::Config[:signout_after_password_change])
31
+ sign_in(@user, event: :authentication, bypass: !Spree::Auth::Config[:signout_after_password_change])
32
32
  end
33
- redirect_to spree.account_url, :notice => Spree.t(:account_updated)
33
+ redirect_to spree.account_url, notice: Spree.t(:account_updated)
34
34
  else
35
35
  render :edit
36
36
  end
37
37
  end
38
38
 
39
39
  private
40
- def user_params
41
- params.require(:user).permit(Spree::PermittedAttributes.user_attributes)
42
- end
43
40
 
44
- def load_object
45
- @user ||= spree_current_user
46
- authorize! params[:action].to_sym, @user
47
- end
41
+ def user_params
42
+ params.require(:user).permit(Spree::PermittedAttributes.user_attributes)
43
+ end
48
44
 
49
- def authorize_actions
50
- authorize! params[:action].to_sym, Spree::User.new
51
- end
45
+ def load_object
46
+ @user ||= spree_current_user
47
+ authorize! params[:action].to_sym, @user
48
+ end
52
49
 
53
- def accurate_title
54
- Spree.t(:my_account)
55
- end
50
+ def authorize_actions
51
+ authorize! params[:action].to_sym, Spree::User.new
52
+ end
53
+
54
+ def accurate_title
55
+ Spree.t(:my_account)
56
+ end
56
57
  end
@@ -2,8 +2,10 @@ module Spree
2
2
  module Auth
3
3
  module Generators
4
4
  class InstallGenerator < Rails::Generators::Base
5
+ class_option :migrate, type: :boolean, default: true, banner: 'Migrate the database'
6
+
5
7
  def self.source_paths
6
- paths = self.superclass.source_paths
8
+ paths = superclass.source_paths
7
9
  paths << File.expand_path('../templates', __FILE__)
8
10
  paths.flatten
9
11
  end
@@ -22,7 +24,11 @@ module Spree
22
24
  end
23
25
 
24
26
  def run_migrations
25
- run 'bundle exec rake db:migrate'
27
+ if options[:migrate]
28
+ run 'bundle exec rake db:migrate VERBOSE=false'
29
+ else
30
+ puts "Skiping rake db:migrate, don't forget to run it!"
31
+ end
26
32
  end
27
33
  end
28
34
  end
@@ -9,7 +9,7 @@ module Spree
9
9
  module Auth
10
10
  mattr_accessor :default_secret_key
11
11
 
12
- def self.config(&block)
12
+ def self.config
13
13
  yield(Spree::Auth::Config)
14
14
  end
15
15
  end
@@ -7,11 +7,11 @@ module Spree
7
7
  isolate_namespace Spree
8
8
  engine_name 'spree_auth'
9
9
 
10
- initializer "spree.auth.environment", :before => :load_config_initializers do |app|
10
+ initializer "spree.auth.environment", before: :load_config_initializers do |_app|
11
11
  Spree::Auth::Config = Spree::AuthConfiguration.new
12
12
  end
13
13
 
14
- initializer "spree_auth_devise.set_user_class", :after => :load_config_initializers do
14
+ initializer "spree_auth_devise.set_user_class", after: :load_config_initializers do
15
15
  Spree.user_class = "Spree::User"
16
16
  end
17
17
 
@@ -20,7 +20,7 @@ module Spree
20
20
  puts "[WARNING] You are not setting Devise.secret_key within your application!"
21
21
  puts "You must set this in config/initializers/devise.rb. Here's an example:"
22
22
  puts " "
23
- puts %Q{Devise.secret_key = "#{SecureRandom.hex(50)}"}
23
+ puts %{Devise.secret_key = "#{SecureRandom.hex(50)}"}
24
24
  end
25
25
  end
26
26
 
@@ -49,24 +49,24 @@ module Spree
49
49
  ApplicationController.send :include, Spree::AuthenticationHelpers
50
50
  end
51
51
 
52
- def self.backend_available?
53
- @@backend_available ||= ::Rails::Engine.subclasses.map(&:instance).map{ |e| e.class.to_s }.include?('Spree::Backend::Engine')
52
+ def self.api_available?
53
+ @@api_available ||= ::Rails::Engine.subclasses.map(&:instance).map{ |e| e.class.to_s }.include?('Spree::Api::Engine')
54
54
  end
55
55
 
56
- def self.dash_available?
57
- @@dash_available ||= ::Rails::Engine.subclasses.map(&:instance).map{ |e| e.class.to_s }.include?('Spree::Dash::Engine')
56
+ def self.backend_available?
57
+ @@backend_available ||= ::Rails::Engine.subclasses.map(&:instance).map{ |e| e.class.to_s }.include?('Spree::Backend::Engine')
58
58
  end
59
59
 
60
60
  def self.frontend_available?
61
61
  @@frontend_available ||= ::Rails::Engine.subclasses.map(&:instance).map{ |e| e.class.to_s }.include?('Spree::Frontend::Engine')
62
62
  end
63
63
 
64
- if self.backend_available?
64
+ if backend_available?
65
65
  paths["app/controllers"] << "lib/controllers/backend"
66
66
  paths["app/views"] << "lib/views/backend"
67
67
  end
68
68
 
69
- if self.frontend_available?
69
+ if frontend_available?
70
70
  paths["app/controllers"] << "lib/controllers/frontend"
71
71
  paths["app/views"] << "lib/views/frontend"
72
72
  end
data/lib/tasks/auth.rake CHANGED
@@ -1,7 +1,7 @@
1
1
  namespace :spree_auth do
2
2
  namespace :admin do
3
3
  desc "Create admin username and password"
4
- task :create => :environment do
4
+ task create: :environment do
5
5
  require File.join(File.dirname(__FILE__), '..', '..', 'db', 'default', 'users.rb')
6
6
  puts "Done!"
7
7
  end
@@ -27,7 +27,7 @@
27
27
  <tr>
28
28
  <td class="order-number"><%= link_to order.number, order_url(order) %></td>
29
29
  <td class="order-date"><%= l order.completed_at.to_date %></td>
30
- <td class="order-status"><%= Spree.t("order_state.#{order.state}").titleize %></td>
30
+ <td class="order-status"><%= Spree.t("order_states.#{order.state}").titleize %></td>
31
31
  <td class="order-payment-state"><%= Spree.t("payment_states.#{order.payment_state}").titleize if order.payment_state %></td>
32
32
  <td class="order-shipment-state"><%= Spree.t("shipment_states.#{order.shipment_state}").titleize if order.shipment_state %></td>
33
33
  <td class="lead text-primary order-total"><%= order.display_total %></td>
@@ -1,5 +1,4 @@
1
1
  RSpec.describe Spree::CheckoutController, type: :controller do
2
-
3
2
  let(:order) { create(:order_with_totals, email: nil, user: nil) }
4
3
  let(:user) { build(:user, spree_api_key: 'fake') }
5
4
  let(:token) { 'some_token' }
@@ -114,7 +113,7 @@ RSpec.describe Spree::CheckoutController, type: :controller do
114
113
  controller.stub :check_authorization
115
114
  order.stub update_attributes: true
116
115
  controller.should_not_receive :check_registration
117
- spree_put :update_registration, { order: { } }
116
+ spree_put :update_registration, { order: {} }
118
117
  end
119
118
 
120
119
  it 'renders the registration view if unable to save' do
@@ -1,5 +1,4 @@
1
1
  RSpec.describe Spree::ProductsController, type: :controller do
2
-
3
2
  let!(:product) { create(:product, available_on: 1.year.from_now) }
4
3
  let!(:user) { build(:user, spree_api_key: 'fake') }
5
4
 
@@ -1,5 +1,4 @@
1
1
  RSpec.describe Spree::UserPasswordsController, type: :controller do
2
-
3
2
  let(:token) { 'some_token' }
4
3
 
5
4
  before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] }
@@ -16,7 +15,7 @@ RSpec.describe Spree::UserPasswordsController, type: :controller do
16
15
  it 'flashes an error' do
17
16
  spree_get :edit
18
17
  expect(flash[:alert]).to include(
19
- "You can't access this page without coming from a password reset " +
18
+ "You can't access this page without coming from a password reset " \
20
19
  'email'
21
20
  )
22
21
  end
@@ -34,9 +33,9 @@ RSpec.describe Spree::UserPasswordsController, type: :controller do
34
33
  context 'when updating password with blank password' do
35
34
  it 'shows error flash message, sets spree_user with token and re-displays password edit form' do
36
35
  spree_put :update, { spree_user: { password: '', password_confirmation: '', reset_password_token: token } }
37
- expect(assigns(:spree_user).kind_of?(Spree::User)).to eq true
36
+ expect(assigns(:spree_user).is_a?(Spree::User)).to eq true
38
37
  expect(assigns(:spree_user).reset_password_token).to eq token
39
- expect(flash[:error]).to eq I18n.t(:cannot_be_blank, scope: [:devise, :passwords, :spree_user])
38
+ expect(flash[:error]).to eq I18n.t(:cannot_be_blank, scope: [:devise, :user_passwords, :spree_user])
40
39
  expect(response).to render_template :edit
41
40
  end
42
41
  end
@@ -1,5 +1,4 @@
1
1
  RSpec.describe Spree::UserRegistrationsController, type: :controller do
2
-
3
2
  before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] }
4
3
 
5
4
  context '#create' do
@@ -1,5 +1,4 @@
1
1
  RSpec.describe Spree::UserSessionsController, type: :controller do
2
-
3
2
  let(:user) { create(:user) }
4
3
 
5
4
  before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] }
@@ -1,5 +1,4 @@
1
1
  RSpec.describe Spree::UsersController, type: :controller do
2
-
3
2
  let(:admin_user) { create(:user) }
4
3
  let(:user) { create(:user) }
5
4
  let(:role) { create(:role) }
@@ -4,4 +4,4 @@ FactoryGirl.define do
4
4
  confirmation_sent_at { Time.now }
5
5
  confirmation_token "12345"
6
6
  end
7
- end
7
+ end
@@ -1,5 +1,4 @@
1
1
  RSpec.feature 'Accounts', type: :feature do
2
-
3
2
  context 'editing' do
4
3
  scenario 'can edit an admin user', js: true do
5
4
  user = create(:admin_user, email: 'admin@person.com', password: 'password', password_confirmation: 'password')
@@ -1,5 +1,4 @@
1
1
  RSpec.feature 'Admin orders', type: :feature do
2
-
3
2
  background do
4
3
  sign_in_as! create(:admin_user)
5
4
  end
@@ -1,5 +1,4 @@
1
1
  RSpec.feature 'Admin - Reset Password', type: :feature do
2
-
3
2
  let!(:store) { create(:store) }
4
3
 
5
4
  background do
@@ -1,5 +1,4 @@
1
1
  RSpec.feature 'Admin products', type: :feature do
2
-
3
2
  context 'as anonymous user' do
4
3
  # Regression test for #1250
5
4
  scenario 'redirects to login page when attempting to access product listing' do
@@ -1,5 +1,4 @@
1
1
  RSpec.feature 'Admin - Sign In', type: :feature do
2
-
3
2
  background do
4
3
  @user = create(:user, email: 'email@person.com')
5
4
  visit spree.admin_login_path
@@ -1,5 +1,4 @@
1
1
  RSpec.feature 'Admin - Sign Out', type: :feature do
2
-
3
2
  given!(:user) do
4
3
  create :user, email: 'email@person.com'
5
4
  end
@@ -1,5 +1,4 @@
1
1
  RSpec.feature 'Admin Permissions', type: :feature do
2
-
3
2
  context 'orders' do
4
3
  background do
5
4
  user = create(:admin_user, email: 'admin@person.com', password: 'password', password_confirmation: 'password')
@@ -1,5 +1,4 @@
1
1
  RSpec.feature 'Change email', type: :feature do
2
-
3
2
  background do
4
3
  user = create(:user)
5
4
  visit spree.root_path
@@ -47,9 +47,9 @@ RSpec.feature 'Checkout', :js, type: :feature do
47
47
  str_addr = 'bill_address'
48
48
  select 'United States', from: "order_#{str_addr}_attributes_country_id"
49
49
  %w(firstname lastname address1 city zipcode phone).each do |field|
50
- fill_in "order_#{str_addr}_attributes_#{field}", with: "#{address.send(field)}"
50
+ fill_in "order_#{str_addr}_attributes_#{field}", with: address.send(field).to_s
51
51
  end
52
- select "#{address.state.name}", from: "order_#{str_addr}_attributes_state_id"
52
+ select address.state.name.to_s, from: "order_#{str_addr}_attributes_state_id"
53
53
  check 'order_use_billing'
54
54
 
55
55
  click_button 'Save and Continue'
@@ -77,9 +77,9 @@ RSpec.feature 'Checkout', :js, type: :feature do
77
77
  str_addr = 'bill_address'
78
78
  select 'United States', from: "order_#{str_addr}_attributes_country_id"
79
79
  %w(firstname lastname address1 city zipcode phone).each do |field|
80
- fill_in "order_#{str_addr}_attributes_#{field}", with: "#{address.send(field)}"
80
+ fill_in "order_#{str_addr}_attributes_#{field}", with: address.send(field).to_s
81
81
  end
82
- select "#{address.state.name}", from: "order_#{str_addr}_attributes_state_id"
82
+ select address.state.name.to_s, from: "order_#{str_addr}_attributes_state_id"
83
83
  check 'order_use_billing'
84
84
 
85
85
  click_button 'Save and Continue'
@@ -118,9 +118,9 @@ RSpec.feature 'Checkout', :js, type: :feature do
118
118
  str_addr = 'bill_address'
119
119
  select 'United States', from: "order_#{str_addr}_attributes_country_id"
120
120
  %w(firstname lastname address1 city zipcode phone).each do |field|
121
- fill_in "order_#{str_addr}_attributes_#{field}", with: "#{address.send(field)}"
121
+ fill_in "order_#{str_addr}_attributes_#{field}", with: address.send(field).to_s
122
122
  end
123
- select "#{address.state.name}", from: "order_#{str_addr}_attributes_state_id"
123
+ select address.state.name.to_s, from: "order_#{str_addr}_attributes_state_id"
124
124
  check 'order_use_billing'
125
125
 
126
126
  click_button 'Save and Continue'
@@ -145,9 +145,9 @@ RSpec.feature 'Checkout', :js, type: :feature do
145
145
  str_addr = 'bill_address'
146
146
  select 'United States', from: "order_#{str_addr}_attributes_country_id"
147
147
  %w(firstname lastname address1 city zipcode phone).each do |field|
148
- fill_in "order_#{str_addr}_attributes_#{field}", with: "#{address.send(field)}"
148
+ fill_in "order_#{str_addr}_attributes_#{field}", with: address.send(field).to_s
149
149
  end
150
- select "#{address.state.name}", from: "order_#{str_addr}_attributes_state_id"
150
+ select address.state.name.to_s, from: "order_#{str_addr}_attributes_state_id"
151
151
  check 'order_use_billing'
152
152
 
153
153
  click_button 'Save and Continue'