Sha256: 32c481ad9b7a2254c918c6c932f59dbc8d90028101607c4814d4ede7ea798b29

Contents?: true

Size: 1.61 KB

Versions: 5

Compression:

Stored size: 1.61 KB

Contents

require File.expand_path('../spec_helper', File.dirname(__FILE__))

module Ftpd
  module ListFormat
    describe Eplf do

      context '(file)' do

        let(:file_info) do
          FileInfo.new(:ftype => 'file',
                       :mode => 0100644,
                       :mtime => Time.mktime(2013, 3, 3, 8, 38, 0),
                       :path => 'foo',
                       :size => 1234)
        end
        subject(:formatter) {Eplf.new(file_info)}

        it 'should produce EPLF format' do
          formatter.to_s.should == "+r,s1234,m1362325080\tfoo"
        end

      end

      context '(directory)' do

        let(:file_info) do
          FileInfo.new(:ftype => 'directory',
                       :mode => 0100644,
                       :mtime => Time.mktime(2013, 3, 3, 8, 38, 0),
                       :path => 'foo',
                       :size => 1024)
        end
        subject(:formatter) {Eplf.new(file_info)}

        it 'should produce EPLF format' do
          formatter.to_s.should == "+/,m1362325080\tfoo"
        end

      end

      context '(with identifier)' do

        let(:file_info) do
          FileInfo.new(:ftype => 'file',
                       :mode => 0100644,
                       :mtime => Time.mktime(2013, 3, 3, 8, 38, 0),
                       :path => 'foo',
                       :identifier => '1234.5678',
                       :size => 1234)
        end
        subject(:formatter) {Eplf.new(file_info)}

        it 'should produce EPLF format' do
          formatter.to_s.should ==
            "+r,s1234,m1362325080,i1234.5678\tfoo"
        end

      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ftpd-0.6.0 spec/list_format/eplf_spec.rb
ftpd-0.5.0 spec/list_format/eplf_spec.rb
ftpd-0.4.0 spec/list_format/eplf_spec.rb
ftpd-0.3.2 spec/list_format/eplf_spec.rb
ftpd-0.3.1 spec/list_format/eplf_spec.rb