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.5.15 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.36 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.14 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.35 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.13 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.34 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.12 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.33 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.11 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.10 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.32 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.9 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.31 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.8 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.30 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.7 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.29 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.6 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.4.28 test/view_models/workarea/storefront/user_view_model_test.rb
workarea-storefront-3.5.5 test/view_models/workarea/storefront/user_view_model_test.rb