Sha256: 19a83a59013620975944c71a5a5c25ca305efa95b93f78d4b093eb0f1975b25e

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

# coding: utf-8

require 'test_helper'

class Thinreports::Core::Shape::List::TestConfiguration < Minitest::Test
  include Thinreports::TestHelper

  List = Thinreports::Core::Shape::List

  def setup
    @events = mock('events')
    @store  = mock('store')
    @config = List::Configuration.new
  end

  def test_use_stores
    List::Store.expects(:init).once

    @config.use_stores(a: 0, b: 0)
  end

  def test_events
    assert_instance_of List::Events, @config.events

    _out, err = capture_io do
      @config.events
    end
    assert_includes err, '[DEPRECATION]'
  end

  def test_internal_events
    assert_same @config.events, @config.internal_events
  end

  def test_store
    List::Store.expects(:init).returns(@store)

    @config.use_stores(a: 0, b: 0)
    assert_same @config.store, @store
  end

  def test_store_return_nil_when_uninitialized_yet
    assert_nil @config.store
  end

  def test_type
    assert_equal @config.type, List::TYPE_NAME
  end

  def test_copy
    copied_store = mock('copied store')

    @store.stubs(copy: copied_store)
    List::Store.expects(:init).returns(@store)

    copied_events = mock('copied events')

    @events.stubs(copy: copied_events)
    List::Events.expects(:new).returns(@events)

    @config = List::Configuration.new
    @config.use_stores(a: 1)

    copied_config = @config.copy

    assert_same copied_config.events, copied_events
    assert_same copied_config.store, copied_store
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.8.2 test/unit/core/shape/list/test_configuration.rb