Sha256: 257dff8445595e3e81fe196516d39726a55e7a56852111d563bf440280b1a482

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

require 'spec_helper'

describe AktionTest::Matchers::FileSystem::DirectoryExistance::Matcher do
  context "an existing directory" do
    let(:dir) { File.expand_path(File.join(__FILE__, '..')) }

    it "will be accepeted" do
      dir.should be_a_directory
    end

    it "provides a negative failure message" do
      matcher = described_class.new
      matcher.matches?(dir)
      matcher.negative_failure_message.should == <<-MSG.strip_heredoc
        Did not expect #{dir} to be a directory.

      MSG
    end
  end

  context "a non-existant directory" do
    let(:dir) { File.expand_path(File.join(__FILE__, '..', 'foo')) }

    it "will not be accepted" do
      dir.should_not be_a_directory
    end

    it "explains that the subject does not exist" do
      matcher = described_class.new
      matcher.matches?(dir)
      matcher.failure_message.should == <<-MSG.strip_heredoc
        Expected #{dir} to be a directory.
        #{dir} does not exist.
      MSG
    end
  end

  context "a file" do
    let(:dir) { __FILE__ }

    it "will not be accepted" do
      dir.should_not be_a_directory
    end

    it "explains that the subject is a file" do
      matcher = described_class.new
      matcher.matches?(dir)
      matcher.failure_message.should == <<-MSG.strip_heredoc
        Expected #{dir} to be a directory.
        #{dir} is not a directory.
      MSG
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aktion_test-0.3.1 spec/matchers/directory_existance_spec.rb
aktion_test-0.3.0 spec/matchers/directory_existance_spec.rb
aktion_test-0.2.2 spec/matchers/directory_existance_spec.rb
aktion_test-0.2.1 spec/matchers/directory_existance_spec.rb
aktion_test-0.2.0 spec/matchers/directory_existance_spec.rb