Sha256: 0cda242f4e7362007b6099073f82760c8118835ebfc5f39843108a89ecc08eaf

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

require 'test_helper'

module Vedeu

  describe FileRenderer do

    let(:described) { Vedeu::FileRenderer }
    let(:instance)  { described.new(output, options) }
    let(:output)    {}
    let(:options)   {
      {
        timestamp: timestamp
      }
    }
    let(:timestamp) { true }

    describe '#initialize' do
      it { instance.must_be_instance_of(Vedeu::FileRenderer) }
      it { instance.instance_variable_get('@output').must_equal(output) }
      it { instance.instance_variable_get('@options').must_equal(options) }
    end

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

      before { File.stubs(:open) }

      subject { described.render(output, options) }

      it { subject.must_be_instance_of(String) }

      # context 'when the timestamp option is true' do
      #   before { Time.stubs(:now).returns(_time) }

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

      # context 'when the timestamp option is false' do
      #   let(:timestamp) { false }

      #   it { File.expects(:open).with('/tmp/out', 'w'); subject }
      # end
    end

  end # FileRenderer

end # Vedeu

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.4.17 test/lib/vedeu/output/renderers/file_renderer_test.rb
vedeu-0.4.16 test/lib/vedeu/output/renderers/file_renderer_test.rb