diff options
| author | hukl <contact@smyck.org> | 2011-02-10 14:19:00 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2011-02-10 14:19:00 +0100 |
| commit | 7379daad1c73bd3610ed296436250b417ac3673d (patch) | |
| tree | 04f722efc678de9d3aa5bf8f1c96e3be33b18bc4 /vendor/plugins/thinking-sphinx/features/step_definitions/search_steps.rb | |
| parent | 91633ac4419d839661e35ae8f2efe5c9089cfb67 (diff) | |
removed thinking_sphinx plugin and replaced it with gem.
also tuned dependencies
Diffstat (limited to 'vendor/plugins/thinking-sphinx/features/step_definitions/search_steps.rb')
| -rw-r--r-- | vendor/plugins/thinking-sphinx/features/step_definitions/search_steps.rb | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/search_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/search_steps.rb deleted file mode 100644 index 8c64dd7..0000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/search_steps.rb +++ /dev/null | |||
| @@ -1,66 +0,0 @@ | |||
| 1 | When /^I search for the specific id of (\d+) in the (\w+) index$/ do |id, index| | ||
| 2 | @id = id.to_i | ||
| 3 | @index = index | ||
| 4 | end | ||
| 5 | |||
| 6 | When /^I search for the document id of (\w+) (\w+) in the (\w+) index$/ do |model, name, index| | ||
| 7 | model = model.gsub(/\s/, '_').camelize.constantize | ||
| 8 | @id = model.find_by_name(name).sphinx_document_id | ||
| 9 | @index = index | ||
| 10 | end | ||
| 11 | |||
| 12 | Then "it should exist" do | ||
| 13 | ThinkingSphinx::Search.search_for_id(@id, @index).should == true | ||
| 14 | end | ||
| 15 | |||
| 16 | Then "it should not exist" do | ||
| 17 | ThinkingSphinx::Search.search_for_id(@id, @index).should == false | ||
| 18 | end | ||
| 19 | |||
| 20 | Then "it should exist if using Rails 2.1 or newer" do | ||
| 21 | require 'active_record/version' | ||
| 22 | unless ActiveRecord::VERSION::STRING.to_f < 2.1 | ||
| 23 | ThinkingSphinx::Search.search_for_id(@id, @index).should == true | ||
| 24 | end | ||
| 25 | end | ||
| 26 | |||
| 27 | Then "it should not exist if using Rails 2.1 or newer" do | ||
| 28 | require 'active_record/version' | ||
| 29 | unless ActiveRecord::VERSION::STRING.to_f < 2.1 | ||
| 30 | ThinkingSphinx::Search.search_for_id(@id, @index).should == false | ||
| 31 | end | ||
| 32 | end | ||
| 33 | |||
| 34 | Then /^I can iterate by result and group and count$/ do | ||
| 35 | results.each_with_groupby_and_count do |result, group, count| | ||
| 36 | result.should be_kind_of(@model) | ||
| 37 | count.should be_kind_of(Integer) | ||
| 38 | group.should be_kind_of(Integer) | ||
| 39 | end | ||
| 40 | end | ||
| 41 | |||
| 42 | Then "each result id should match the corresponding sphinx internal id" do | ||
| 43 | results.each_with_sphinx_internal_id do |result, id| | ||
| 44 | result.id.should == id | ||
| 45 | end | ||
| 46 | end | ||
| 47 | |||
| 48 | Then "I should have an array of integers" do | ||
| 49 | results.each do |result| | ||
| 50 | result.should be_kind_of(Integer) | ||
| 51 | end | ||
| 52 | end | ||
| 53 | |||
| 54 | Then "searching for ids should match the record ids of the normal search results" do | ||
| 55 | normal_results = results | ||
| 56 | |||
| 57 | # reset search, switch method | ||
| 58 | @results = nil | ||
| 59 | @method = :search_for_ids | ||
| 60 | |||
| 61 | results.should == normal_results.collect(&:id) | ||
| 62 | end | ||
| 63 | |||
| 64 | Then /^I should get a value of (\d+)$/ do |count| | ||
| 65 | results.should == count.to_i | ||
| 66 | end \ No newline at end of file | ||
