Sha256: 2e738722ea3a9741acd737df61975813e8c01c1ac7c352709afc2cd4b0bcc7ac

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

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

module Ftpd
  describe FileInfo do

    subject {FileInfo.new(opts)}

    def self.it_has_attribute(attribute)
      describe "##{attribute}" do
        let(:value) {"#{attribute} value"}
        let(:opts) {{attribute => value}}
        its(attribute) {should == value}
      end
    end

    it_has_attribute :ftype
    it_has_attribute :group
    it_has_attribute :identifier
    it_has_attribute :mode
    it_has_attribute :mtime
    it_has_attribute :nlink
    it_has_attribute :owner
    it_has_attribute :path
    it_has_attribute :size

    describe '#file?' do

      let(:opts) {{:ftype => ftype}}

      context '(file)' do
        let(:ftype) {'file'}
        its(:file?) {should be_truthy}
      end

      context '(directory)' do
        let(:ftype) {'directory'}
        its(:file?) {should be_falsey}
      end

    end

    describe '#directory?' do

      let(:opts) {{:ftype => ftype}}

      context '(file)' do
        let(:ftype) {'file'}
        its(:directory?) {should be_falsey}
      end

      context '(directory)' do
        let(:ftype) {'directory'}
        its(:directory?) {should be_truthy}
      end

    end

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
ftpd-1.1.1 spec/file_info_spec.rb
ftpd-1.1.0 spec/file_info_spec.rb
investtools-ftpd-1.0.1 spec/file_info_spec.rb
ftpd-1.0.1 spec/file_info_spec.rb
ftpd-1.0.0 spec/file_info_spec.rb