Sha256: b746a022f31e10b4a0929d15e7ea1bf4911cb1ce7916a85d9cb527b1fc8199b7

Contents?: true

Size: 1.17 KB

Versions: 9

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require 'test_helper'

module Vedeu

  module Repositories

    class DefaultsTestClass

      include Vedeu::Repositories::Defaults

      private

      def defaults
        {
          some_attribute: :some_value
        }
      end

    end # DefaultsTestClass

    describe Defaults do

      let(:described)  { Vedeu::Repositories::Defaults }
      let(:includer)   { Vedeu::Repositories::DefaultsTestClass }
      let(:instance)   { includer.new(attributes) }
      let(:attributes) {
        {
          invalid_attribute: :invalid_value
        }
      }

      describe '#initialize' do
        it { instance.must_be_instance_of(includer) }
        it do
          instance.instance_variable_get('@some_attribute').
            must_equal(:some_value)
        end
        it do
          instance.instance_variables.
            must_equal([:@some_attribute])
        end

        context 'when the attributes is not a Hash' do
          let(:attributes) { :invalid }

          it { proc { instance }.must_raise(Vedeu::Error::InvalidSyntax) }
        end
      end

      # @todo Add more tests.

    end # Defaults

  end # Repositories

end # Vedeu

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vedeu-0.8.9 test/lib/vedeu/repositories/defaults_test.rb
vedeu-0.8.8 test/lib/vedeu/repositories/defaults_test.rb
vedeu-0.8.7 test/lib/vedeu/repositories/defaults_test.rb
vedeu-0.8.6 test/lib/vedeu/repositories/defaults_test.rb
vedeu-0.8.5 test/lib/vedeu/repositories/defaults_test.rb
vedeu-0.8.4 test/lib/vedeu/repositories/defaults_test.rb
vedeu-0.8.3 test/lib/vedeu/repositories/defaults_test.rb
vedeu-0.8.2 test/lib/vedeu/repositories/defaults_test.rb
vedeu-0.8.1 test/lib/vedeu/repositories/defaults_test.rb