Sha256: 831db65ba1db06e0f0b5f5537b08babef0189101cfec94512a8b3022252a606f

Contents?: true

Size: 879 Bytes

Versions: 1

Compression:

Stored size: 879 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Spotlight::Query do
  before do
    @query = Spotlight::Query.new('kMDItemDisplayName = "spotlight_query_spec.rb"')
  end

  it "should have query string" do
    @query.query_string.should eql('kMDItemDisplayName = "spotlight_query_spec.rb"')
  end

  it "should execute query" do
    @query.scopes << File.expand_path(File.dirname(__FILE__))
    result = @query.execute
    result.size.should eql(1)
    result.first.should be_an_instance_of(Spotlight::MDItemNative)
    result.first.get(:kMDItemPath).should eql(File.expand_path(File.dirname(__FILE__) + '/spotlight_query_spec.rb'))

    @query.scopes = ['/tmp/xxx/yyy']
    result = @query.execute
    result.should be_empty
  end

  it "should execute query with empty scope" do
    result = @query.execute
    result.should_not be_empty 
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spotlight-0.0.2 spec/spotlight_query_spec.rb