summaryrefslogtreecommitdiff
path: root/vendor/plugins/thinking-sphinx/features/step_definitions/facet_steps.rb
diff options
context:
space:
mode:
authorUser <hukl@cccms.ccc.de>2011-02-10 14:23:36 +0100
committerUser <hukl@cccms.ccc.de>2011-02-10 14:23:36 +0100
commit384b187e9e067ddf2bb4d5fad0c2deaf96f69c89 (patch)
treecf743f377d3e2e28a31ae0359d95f37beba82cc3 /vendor/plugins/thinking-sphinx/features/step_definitions/facet_steps.rb
parent3d0de09cf94cee6233b36a7f5ce20d5059854acc (diff)
parentcec2b1e2881db0000b2a09029154bea0fc62ade3 (diff)
Merge branch 'master' of ssh://svn.medienhaus.udk-berlin.de/usr/local/git/cccms
Diffstat (limited to 'vendor/plugins/thinking-sphinx/features/step_definitions/facet_steps.rb')
-rw-r--r--vendor/plugins/thinking-sphinx/features/step_definitions/facet_steps.rb72
1 files changed, 0 insertions, 72 deletions
diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/facet_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/facet_steps.rb
deleted file mode 100644
index b7885290..00000000
--- a/vendor/plugins/thinking-sphinx/features/step_definitions/facet_steps.rb
+++ /dev/null
@@ -1,72 +0,0 @@
1When "I am requesting facet results$" do
2 @results = nil
3 @method = :facets
4end
5
6When "I want classes included" do
7 @options[:class_facet] = true
8end
9
10When "I don't want classes included" do
11 @options[:class_facet] = false
12end
13
14When "I want all possible attributes" do
15 @options[:all_attributes] = true
16end
17
18When /^I drill down where (\w+) is (\w+)$/ do |facet, value|
19 @results = results.for(facet.downcase.to_sym => value)
20end
21
22When /^I drill down where (\w+) is (\w+) and (\w+) is (\w+)$/ do |facet_one, value_one, facet_two, value_two|
23 value_one = value_one.to_i unless value_one[/^\d+$/].nil?
24 value_two = value_two.to_i unless value_two[/^\d+$/].nil?
25
26 @results = results.for(
27 facet_one.downcase.to_sym => value_one,
28 facet_two.downcase.to_sym => value_two
29 )
30end
31
32When /^I drill down where ([\w_]+) includes the id of tag (\w+)$/ do |facet, text|
33 tag = Tag.find_by_text(text)
34 @results = results.for(facet.downcase.to_sym => tag.id)
35end
36
37When /^I drill down where ([\w_]+) includes the id of tags (\w+) or (\w+)$/ do |facet, text_one, text_two|
38 tag_one = Tag.find_by_text(text_one)
39 tag_two = Tag.find_by_text(text_two)
40 @results = results.for(facet.downcase.to_sym => [tag_one.id, tag_two.id])
41end
42
43Then "I should have valid facet results" do
44 results.should be_kind_of(Hash)
45 results.values.each { |value| value.should be_kind_of(Hash) }
46end
47
48Then /^I should have (\d+) facets?$/ do |count|
49 results.keys.length.should == count.to_i
50end
51
52Then /^I should have the facet ([\w_\s]+)$/ do |name|
53 results[facet_name(name)].should be_kind_of(Hash)
54end
55
56Then /^I should not have the facet ([\w_\s]+)$/ do |name|
57 results.keys.should_not include(facet_name(name))
58end
59
60Then /^the ([\w_\s]+) facet should have a "([\w\s_]+)" key with (\d+) hits$/ do |name, key, hit_count|
61 facet_name = facet_name name
62 results[facet_name].keys.should include(key)
63 results[facet_name][key].should eql(hit_count.to_i)
64end
65
66Then /^the ([\w_\s]+) facet should have a "(\w+)" key$/ do |name, key|
67 results[facet_name(name)].keys.should include(key)
68end
69
70def facet_name(string)
71 string.gsub(/\s/, '').underscore.to_sym
72end