Sha256: 668d2d7ee25c836901cc8ba4f3806ed977cde8a52b1d605572fbf3e7777de739

Contents?: true

Size: 973 Bytes

Versions: 62

Compression:

Stored size: 973 Bytes

Contents

require 'test_helper'

module Workarea
  module Storefront
    class UserViewModelTest < TestCase
      def test_has_default_addresses
        user = User.new
        view_model = Storefront::UserViewModel.new(user)
        refute(view_model.has_default_addresses?)

        user.addresses.build
        assert(view_model.has_default_addresses?)
      end

      def test_default_credit_card_gets_the_default_card_from_payment
        user = create_user
        profile = Payment::Profile.lookup(PaymentReference.new(user))
        card = create_saved_credit_card(profile: profile)

        view_model = Storefront::UserViewModel.new(user)
        assert_equal(card, view_model.default_credit_card)
      end

      def test_email_signup
        user = create_user

        Email.signup(user.email)
        assert(UserViewModel.wrap(user).email_signup?)

        Email.unsignup(user.email)
        refute(UserViewModel.wrap(user).email_signup?)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.4.27 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.4 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.26 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.3 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.25 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.2 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.24 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.1 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.23 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.22 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.0 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.21 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.0.beta.1 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.20 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.19 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.18 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.17 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.16 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.15 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.14 test/view_models/workarea/storefront/user_view_model_test.rb