Sha256: 11109550dcb9c84a8d41d598240060849059a4a9678524566f82f7c608422014

Contents?: true

Size: 1.19 KB

Versions: 17

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_true}
      end

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

    end

    describe '#directory?' do

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

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

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

    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ftpd-0.17.0 spec/file_info_spec.rb
ftpd-0.16.0 spec/file_info_spec.rb
ftpd-0.15.0 spec/file_info_spec.rb
ftpd-0.14.0 spec/file_info_spec.rb
ftpd-0.13.0 spec/file_info_spec.rb
ftpd-0.12.0 spec/file_info_spec.rb
ftpd-0.11.0 spec/file_info_spec.rb
ftpd-0.10.0 spec/file_info_spec.rb
ftpd-0.9.0 spec/file_info_spec.rb
ftpd-0.7.1 spec/file_info_spec.rb
ftpd-0.8.0 spec/file_info_spec.rb
ftpd-0.7.0 spec/file_info_spec.rb
ftpd-0.6.0 spec/file_info_spec.rb
ftpd-0.5.0 spec/file_info_spec.rb
ftpd-0.4.0 spec/file_info_spec.rb
ftpd-0.3.2 spec/file_info_spec.rb
ftpd-0.3.1 spec/file_info_spec.rb