Sha256: 419ad5de4ea2d217e4fc978b09c54c23639ae7825d3b717a4b5267bf211443bb

Contents?: true

Size: 1015 Bytes

Versions: 4

Compression:

Stored size: 1015 Bytes

Contents

module Tests
  module Shared
    module NotConfiguredDefaultCallback
      def self.included(base)
        base.setup_with :defaults, :not_configured_default_callback do |c|
          c.p2 = 23
          c.p3.p4 = 'CONFIGURED P3P4'

          c.module = -> { 'MODULE' }
        end
      end

      def test_configured_with_default
        assert_equal 'P1', @configuration.p1
      end

      def test_configured_with_overwritten_default
        assert_equal 23, @configuration.p2
      end

      def test_nested_configured_with_default
        assert_equal({ hash: :hash }, @configuration.p3.p5.p7)
      end

      def test_nested_configured_with_overwritten_default
        assert_equal 'CONFIGURED P3P4', @configuration.p3.p4
      end

      def test_not_configured
        assert_raises ArgumentError do
          @configuration.puts
        end
      end

      def test_nested_not_configured
        assert_raises ArgumentError do
          @configuration.p3.p5.p6
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
configurations-2.2.2 test/configurations/shared/not_configured_default_callback.rb
configurations-2.2.1 test/configurations/shared/not_configured_default_callback.rb
configurations-2.2.0 test/configurations/shared/not_configured_default_callback.rb
configurations-2.0.0 test/configurations/shared/not_configured_default_callback.rb