Permalink
Browse files

Return full feature info in search results

  • Loading branch information...
1 parent 95f9cec commit d30e557f28e8b2cec15d0b6723916ad930656c14 @skddc skddc committed Mar 26, 2012
Showing with 9 additions and 7 deletions.
  1. +1 −1 lib/trufflepig/search.rb
  2. +8 −6 spec/trufflepig/search_spec.rb
View
@@ -28,7 +28,7 @@ def scan(file_path)
features.each do |key, feature|
next unless feature["detection_pattern"]
- results << key if content.match(/#{feature["detection_pattern"]}/)
+ results << feature.merge({"slug" => key}) if content.match(/#{feature["detection_pattern"]}/)
end
end
@@ -29,7 +29,7 @@
end
it "finds a truffle" do
- @search.results.must_include "video"
+ @search.results.collect{|f| f["slug"] }.must_include "video"
end
end
@@ -40,11 +40,13 @@
end
it "finds a lot of truffles" do
- @search.results.must_include "video" # html
- @search.results.must_include "stream" # js
- @search.results.must_include "css-boxshadow" # css
- @search.results.must_include "offline-apps"
- @search.results.must_include "canvas"
+ feature_keys = @search.results.collect{|f| f["slug"] }
+
+ 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
end
end

0 comments on commit d30e557

Please sign in to comment.