Sha256: 6d73a96f7d7e37b092069642dcfcf295eb02914d02bf2f5fbc5aed22522e0de8

Contents?: true

Size: 1.44 KB

Versions: 7

Compression:

Stored size: 1.44 KB

Contents

require 'test_helper'

module Vedeu

  module Renderers

    class RenderersTestClass
      include Vedeu::Renderers::Options

      def initialize(options = {})
        @options = options || {}
      end
    end

    describe Options do

      let(:described) { Vedeu::Renderers::Options }
      let(:instance)  { RenderersTestClass.new(options) }
      let(:options)   {
        {
          compression: compression,
        }
      }
      let(:compression) { false }

      describe 'accessors' do
        it { instance.must_respond_to(:options=) }
      end

      describe '#compress?' do
        subject { instance.compress? }

        context 'when the option is not set or is set to false' do
          before { options.tap { |o| o.delete(:compression) } }

          context 'when Vedeu::Configuration.compression? is set to false' do
            before { Vedeu::Configuration.stubs(:compression?).returns(false) }

            it { subject.must_equal(false) }
          end

          context 'when Vedeu::Configuration.compression? is set to true' do
            before { Vedeu::Configuration.stubs(:compression?).returns(true) }

            it { subject.must_equal(true) }
          end
        end

        context 'when the option is set and is true' do
          let(:compression) { true }

          it { subject.must_equal(true) }
        end
      end

      # @todo Add more tests.
      # it { skip }

    end # Options

  end # Renderers

end # Vedeu

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vedeu-0.7.4 test/lib/vedeu/renderers/options_test.rb
vedeu-0.7.3 test/lib/vedeu/renderers/options_test.rb
vedeu-0.7.2 test/lib/vedeu/renderers/options_test.rb
vedeu-0.7.1 test/lib/vedeu/renderers/options_test.rb
vedeu-0.7.0 test/lib/vedeu/renderers/options_test.rb
vedeu-0.6.71 test/lib/vedeu/renderers/options_test.rb
vedeu-0.6.70 test/lib/vedeu/renderers/options_test.rb