Sha256: 09ec285b986159132586fd91bbff42768b9eb79dfa61059800513d34c2eb7111

Contents?: true

Size: 995 Bytes

Versions: 32

Compression:

Stored size: 995 Bytes

Contents

require 'spec_helper'

describe Spree::UserMethods do
  let(:test_user) { create :user }

  describe '#has_spree_role?' do
    subject { test_user.has_spree_role? name }

    let(:role) { Spree::Role.create(name: name) }
    let(:name) { 'test' }

    context 'with a role' do
      before { test_user.spree_roles << role }
      it     { is_expected.to be_truthy }
    end

    context 'without a role' do
      it { is_expected.to be_falsy }
    end
  end

  describe '#last_incomplete_spree_order' do
    subject { test_user.last_incomplete_spree_order }

    context 'with an incomplete order' do
      let(:last_incomplete_order) { create :order, user: test_user }

      before do
        create(:order, user: test_user, created_at: 1.day.ago)
        create(:order, user: create(:user))
        last_incomplete_order
      end

      it { is_expected.to eq last_incomplete_order }
    end

    context 'without an incomplete order' do
      it { is_expected.to be_nil }
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
solidus_core-2.3.1 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.2.2 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.1.1 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.0.3 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-1.4.2 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-1.3.2 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.3.0 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.3.0.rc3 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.3.0.rc2 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.3.0.rc1 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.3.0.beta1 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.0.2 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-1.4.1 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.2.1 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.2.0 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.2.0.rc1 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.2.0.beta1 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.1.0 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.1.0.rc1 spec/models/spree/concerns/user_methods_spec.rb
solidus_core-2.0.1 spec/models/spree/concerns/user_methods_spec.rb