Sha256: 62ab5e814a93a98be130f03cf0e7dc65c0bae4152cbcf9e2e19ad50b2e7db417

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require "spec/spec_helper"
require "lib/stowaway/file_marker"
require "lib/stowaway/locator"
require "lib/stowaway/target_context"

describe Stowaway::Locator do
  
  let(:locator) { Stowaway::Locator.new(%w{.txt}) }
  let(:context) { Stowaway::TargetContext.new("spec/data") }

  it "should be initialized with an array of file extensions to locate" do
    locator.find_all(context).length.should == 2
  end
  
  it "should return an array of FileMarker" do
    @f1 = Stowaway::FileMarker.new("spec/data/testfile1.txt")
    locator.find_all(context)[1].instance_of?(Stowaway::FileMarker).should be_true
  end
  
  it "should return all matched files" do
    @f1 = Stowaway::FileMarker.new("spec/data/testfile1.txt", "spec/data")
    @f2 = Stowaway::FileMarker.new("spec/data/testfile2.txt", "spec/data")
    locator.find_all(context).should == [@f1, @f2]
  end
  
  it "should return true when file has the correct extension" do
    locator.type?("poop.txt").should be_true
  end
  
  it "should return false when file doesn't have the correct extension" do
    locator.type?("poop.stink").should be_false
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stowaway-0.2.5 spec/lib/locator_spec.rb