Sha256: d1bc901f67555f4364e1371e55bc3c85e4d1059441b537830f672d4951ac182b
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
require 'helper' describe Trufflepig::Search do describe "new" do before do @search = Trufflepig::Search.new dummy_app_path end it "has an empty result list" do @search.results.must_be_empty end end describe "perform" do describe "with invalid path" do before do @search = Trufflepig::Search.new "#{dummy_app_path}/tisnofile" end it "raises an exception" do lambda { @search.perform }.must_raise Errno::ENOENT end end describe "with file path" do describe "any file" do before do @search = Trufflepig::Search.new "#{dummy_app_path}/index.html" @search.perform end it "finds a truffle" do @search.results.collect{|f| f["id"] }.must_include "video" end end describe "a well-known JS lib file" do before do @search = Trufflepig::Search.new "#{dummy_app_path}/js/jquery.js" @search.perform end it "finds a truffle" do @search.results.collect{|f| f["id"] }.must_include "getelementsbyclassname" end end end describe "with directory path" do before do @search = Trufflepig::Search.new dummy_app_path @search.perform end it "finds a lot of truffles" do feature_keys = @search.results.collect{|f| f["id"] } feature_keys.must_include "video" # html feature_keys.must_include "stream" # js feature_keys.must_include "css-boxshadow" # css feature_keys.must_include "offline-apps" feature_keys.must_include "canvas" end it "doesn't search in well-known JS libs" do feature_keys = @search.results.collect{|f| f["id"] } feature_keys.wont_include "getelementsbyclassname" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trufflepig-0.2.5 | spec/trufflepig/search_spec.rb |
trufflepig-0.2.4 | spec/trufflepig/search_spec.rb |