Sha256: 4a491018ad9a85496e404ff11777181a9340f395c7d8da0b0fab0684dda8479b

Contents?: true

Size: 1.66 KB

Versions: 15

Compression:

Stored size: 1.66 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,
        }
      }
      let(:filename)  { 'vedeu_renderers_file' }
      let(:timestamp) { false }

      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") }

        before do
          ::File.stubs(:write)
        end

        subject { instance.render(output) }

        # 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

15 entries across 15 versions & 1 rubygems

Version Path
vedeu-0.5.0 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.65 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.64 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.63 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.62 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.61 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.60 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.59 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.58 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.57 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.56 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.55 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.54 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.53 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.4.52 test/lib/vedeu/output/renderers/file_test.rb