Sha256: 5fcfb7b3a3548ccc1bf6c704ca1388c743ca5e4c5a490f146e032995393972d0

Contents?: true

Size: 1.76 KB

Versions: 26

Compression:

Stored size: 1.76 KB

Contents

require 'test_helper'

module Vedeu

  module Renderers

    describe File do

      let(:described) { Vedeu::Renderers::File }
      let(:instance)  { described.new(options) }
      let(:output)    { 'Some content...' }
      let(:options)   {
        {
          filename:    filename,
          timestamp:   timestamp,
          compression: compression,
        }
      }
      let(:filename)    { 'vedeu_renderers_file' }
      let(:timestamp)   { false }
      let(:compression) { false }

      before { ::File.stubs(:write) }

      describe '#initialize' do
        it { instance.must_be_instance_of(described) }
        it { instance.instance_variable_get('@options').must_equal(options) }
      end

      describe '#render' do
        let(:_time) { Time.new(2015, 4, 12, 20, 05, 00, "+01:00") }

        subject { instance.render(output) }

        it { instance.must_respond_to(:clear) }

        # it { subject.must_be_instance_of(String) }

        context 'when the filename option is not set' do
          context 'when the timestamp option is not set' do
            # it {
            #   ::File.expects(:write).with('/tmp/out', nil)
            #   subject
            # }
          end

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

            before { Time.stubs(:now).returns(_time) }

            # it {
            #   ::File.expects(:write).with('/tmp/out_1428865500.0', 'w')
            #   subject
            # }
          end
        end

        context 'when the filename option is set' do
          let(:filename) { 'some_name' }

          # it {
          #   ::File.expects(:write).with('/tmp/some_name', 'w')
          #   subject
          # }
        end
      end

    end # File

  end # Renderers

end # Vedeu

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
vedeu-0.6.71 test/lib/vedeu/renderers/file_test.rb
vedeu-0.6.70 test/lib/vedeu/renderers/file_test.rb
vedeu-0.6.69 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.68 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.67 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.66 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.65 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.64 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.63 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.62 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.61 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.60 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.59 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.58 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.57 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.56 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.54 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.53 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.52 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.51 test/lib/vedeu/output/renderers/file_test.rb