Sha256: 9c7b7af20e67ed8098d18a2081feb99c889ed131dee905080507ea8a97356735

Contents?: true

Size: 1.59 KB

Versions: 5

Compression:

Stored size: 1.59 KB

Contents

# frozen_string_literal: true

require 'test_helper'

module Vedeu

  module Repositories

    class RegisterableTestClass

      include Vedeu::Repositories::Registerable

      null Vedeu::Repositories::ModelTestClass
      real Vedeu::Repositories::ModelTestClass

    end

    describe Registerable do

      let(:described)          { Vedeu::Repositories::Registerable }
      let(:included_described) { Vedeu::Repositories::RegisterableTestClass }

      it { included_described.must_respond_to(:repository) }
      it { included_described.must_respond_to(:register) }

      describe '.null' do
        subject { included_described.new }

        it { included_described.must_respond_to(:null) }

        it { subject.must_respond_to(:null_model) }
        it { subject.must_respond_to(:null_attributes) }
        it { subject.null_model.must_equal(Vedeu::Repositories::ModelTestClass) }
        it { subject.null_attributes.must_equal({}) }
      end

      describe '.real' do
        subject { included_described.new }

        it { included_described.must_respond_to(:real) }

        it { subject.must_respond_to(:model) }
        it { subject.model.must_equal(Vedeu::Repositories::ModelTestClass) }
      end

      describe '.reset' do
        subject { included_described.reset! }

        before { included_described.stubs(:register) }

        it { included_described.must_respond_to(:reset!) }
        it { included_described.must_respond_to(:reset) }

        it do
          included_described.expects(:register)
          subject
        end
      end

    end # Registerable

  end # Repositories

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.8.15 test/lib/vedeu/repositories/registerable_test.rb
vedeu-0.8.14 test/lib/vedeu/repositories/registerable_test.rb
vedeu-0.8.13 test/lib/vedeu/repositories/registerable_test.rb
vedeu-0.8.12 test/lib/vedeu/repositories/registerable_test.rb
vedeu-0.8.10 test/lib/vedeu/repositories/registerable_test.rb