Sha256: b5d4ccd4b6f5c6c2c57050be601fbdd06e3754b5233a47f5af045bc640150e44

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

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

2 entries across 2 versions & 1 rubygems

Version Path
ftpd-2.0.1 spec/file_info_spec.rb
ftpd-2.0.0 spec/file_info_spec.rb