Sha256: ff020a6ba8e3ed25ef9003ed02cfeff511f068968c4ce172b4679c1db73789f7

Contents?: true

Size: 1.64 KB

Versions: 26

Compression:

Stored size: 1.64 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 { ::File.stubs(:write) }

        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

26 entries across 26 versions & 1 rubygems

Version Path
vedeu-0.6.12 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.11 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.10 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.9 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.8 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.7 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.6 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.5 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.4 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.3 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.2 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.1 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.6.0 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.5.13 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.5.12 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.5.11 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.5.10 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.5.9 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.5.8 test/lib/vedeu/output/renderers/file_test.rb
vedeu-0.5.7 test/lib/vedeu/output/renderers/file_test.rb