From 7379daad1c73bd3610ed296436250b417ac3673d Mon Sep 17 00:00:00 2001 From: hukl Date: Thu, 10 Feb 2011 14:19:00 +0100 Subject: removed thinking_sphinx plugin and replaced it with gem. also tuned dependencies --- .../features/step_definitions/alpha_steps.rb | 3 - .../features/step_definitions/beta_steps.rb | 11 -- .../features/step_definitions/cat_steps.rb | 3 - .../features/step_definitions/common_steps.rb | 154 --------------------- .../step_definitions/datetime_delta_steps.rb | 15 -- .../delayed_delta_indexing_steps.rb | 7 - .../extensible_delta_indexing_steps.rb | 7 - .../features/step_definitions/facet_steps.rb | 72 ---------- .../step_definitions/find_arguments_steps.rb | 36 ----- .../features/step_definitions/gamma_steps.rb | 15 -- .../features/step_definitions/search_steps.rb | 66 --------- .../features/step_definitions/sphinx_steps.rb | 27 ---- 12 files changed, 416 deletions(-) delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/alpha_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/beta_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/cat_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/common_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/datetime_delta_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/delayed_delta_indexing_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/extensible_delta_indexing_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/facet_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/find_arguments_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/gamma_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/search_steps.rb delete mode 100644 vendor/plugins/thinking-sphinx/features/step_definitions/sphinx_steps.rb (limited to 'vendor/plugins/thinking-sphinx/features/step_definitions') diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/alpha_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/alpha_steps.rb deleted file mode 100644 index 987b10b0..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/alpha_steps.rb +++ /dev/null @@ -1,3 +0,0 @@ -When /^I change the name of alpha (\w+) to (\w+)$/ do |current, replacement| - Alpha.find_by_name(current).update_attributes(:name => replacement) -end \ No newline at end of file diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/beta_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/beta_steps.rb deleted file mode 100644 index 2d566a1d..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/beta_steps.rb +++ /dev/null @@ -1,11 +0,0 @@ -When /^I destroy beta (\w+)$/ do |name| - Beta.find_by_name(name).destroy -end - -When /^I create a new beta named (\w+)$/ do |name| - Beta.create(:name => name) -end - -When /^I change the name of beta (\w+) to (\w+)$/ do |current, replacement| - Beta.find_by_name(current).update_attributes(:name => replacement) -end \ No newline at end of file diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/cat_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/cat_steps.rb deleted file mode 100644 index 82b8b7f3..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/cat_steps.rb +++ /dev/null @@ -1,3 +0,0 @@ -When /^I destroy cat (\w+)$/ do |name| - Cat.find_by_name(name).destroy -end \ No newline at end of file diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/common_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/common_steps.rb deleted file mode 100644 index de45a20f..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/common_steps.rb +++ /dev/null @@ -1,154 +0,0 @@ -Before do - $queries_executed = [] - ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs - - @model = nil - @method = :search - @query = "" - @conditions = {} - @with = {} - @without = {} - @with_all = {} - @options = {} -end - -Given /^I am searching on (.+)$/ do |model| - @model = model.gsub(/\s/, '_').singularize.camelize.constantize -end - -When /^I am searching for ids$/ do - @results = nil - @method = :search_for_ids -end - -When /^I am retrieving the result count$/ do - @result = nil - @method = @model ? :search_count : :count -end - -When /^I search for (\w+)$/ do |query| - @results = nil - @query = query -end - -When /^I search for "([^\"]+)"$/ do |query| - @results = nil - @query = query -end - -When /^I search for (\w+) on (\w+)$/ do |query, field| - @results = nil - @conditions[field.to_sym] = query -end - -When /^I clear existing filters$/ do - @with = {} - @without = {} - @with_all = {} -end - -When /^I filter by (\w+) on (\w+)$/ do |filter, attribute| - @results = nil - @with[attribute.to_sym] = filter.to_i -end - -When /^I filter by (\d+) and (\d+) on (\w+)$/ do |value_one, value_two, attribute| - @results = nil - @with[attribute.to_sym] = [value_one.to_i, value_two.to_i] -end - -When /^I filter by both (\d+) and (\d+) on (\w+)$/ do |value_one, value_two, attribute| - @results = nil - @with_all[attribute.to_sym] = [value_one.to_i, value_two.to_i] -end - -When /^I filter between ([\d\.]+) and ([\d\.]+) on (\w+)$/ do |first, last, attribute| - @results = nil - if first[/\./].nil? && last[/\./].nil? - @with[attribute.to_sym] = first.to_i..last.to_i - else - @with[attribute.to_sym] = first.to_f..last.to_f - end -end - -When /^I filter between (\d+) and (\d+) days ago on (\w+)$/ do |last, first, attribute| - @results = nil - @with[attribute.to_sym] = first.to_i.days.ago..last.to_i.days.ago -end - -When /^I order by (\w+)$/ do |attribute| - @results = nil - @options[:order] = attribute.to_sym -end - -When /^I order by "([^\"]+)"$/ do |str| - @results = nil - @options[:order] = str -end - -When /^I group results by the (\w+) attribute$/ do |attribute| - @results = nil - @options[:group_function] = :attr - @options[:group_by] = attribute -end - -When /^I set match mode to (\w+)$/ do |match_mode| - @results = nil - @options[:match_mode] = match_mode.to_sym -end - -When /^I set per page to (\d+)$/ do |per_page| - @results = nil - @options[:per_page] = per_page.to_i -end - -When /^I set retry stale to (\w+)$/ do |retry_stale| - @results = nil - @options[:retry_stale] = case retry_stale - when "true" then true - when "false" then false - else retry_stale.to_i - end -end - -Then /^the (\w+) of each result should indicate order$/ do |attribute| - results.inject(nil) do |prev, current| - unless prev.nil? - current.send(attribute.to_sym).should >= prev.send(attribute.to_sym) - end - - current - end -end - -Then /^I can iterate by result and (\w+)$/ do |attribute| - iteration = lambda { |result, attr_value| - result.should be_kind_of(@model) - unless attribute == "group" && attr_value.nil? - attr_value.should be_kind_of(Integer) - end - } - - results.send("each_with_#{attribute}", &iteration) -end - -Then /^I should get (\d+) results?$/ do |count| - results.length.should == count.to_i -end - -Then /^I should not get (\d+) results?$/ do |count| - results.length.should_not == count.to_i -end - -def results - @results ||= (@model || ThinkingSphinx::Search).send( - @method, - @query, - @options.merge( - :conditions => @conditions, - :with => @with, - :without => @without, - :with_all => @with_all - ) - ) -end \ No newline at end of file diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/datetime_delta_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/datetime_delta_steps.rb deleted file mode 100644 index b1d87fee..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/datetime_delta_steps.rb +++ /dev/null @@ -1,15 +0,0 @@ -When /^I index the theta datetime delta$/ do - Theta.sphinx_indexes.first.delta_object.delayed_index(Theta) -end - -When /^I change the name of theta (\w+) to (\w+)$/ do |current, replacement| - Theta.find_by_name(current).update_attributes(:name => replacement) -end - -When /^I create a new theta named (\w+)$/ do |name| - Theta.create(:name => name) -end - -When /^I delete the theta named (\w+)$/ do |name| - Theta.find_by_name(name).destroy -end diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/delayed_delta_indexing_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/delayed_delta_indexing_steps.rb deleted file mode 100644 index dc30ee59..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/delayed_delta_indexing_steps.rb +++ /dev/null @@ -1,7 +0,0 @@ -When /^I run the delayed jobs$/ do - Delayed::Job.work_off.inspect -end - -When /^I change the name of delayed beta (\w+) to (\w+)$/ do |current, replacement| - DelayedBeta.find_by_name(current).update_attributes(:name => replacement) -end diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/extensible_delta_indexing_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/extensible_delta_indexing_steps.rb deleted file mode 100644 index 472e1122..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/extensible_delta_indexing_steps.rb +++ /dev/null @@ -1,7 +0,0 @@ -When /I change the name of extensible beta (\w+) to (\w+)$/ do |current, replacement| - ExtensibleBeta.find_by_name(current).update_attributes(:name => replacement) -end - -Then /^the generic delta handler should handle the delta indexing$/ do - ExtensibleBeta.find(:first, :conditions => {:changed_by_generic => true}).should_not be_nil -end \ No newline at end of file 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 @@ -When "I am requesting facet results$" do - @results = nil - @method = :facets -end - -When "I want classes included" do - @options[:class_facet] = true -end - -When "I don't want classes included" do - @options[:class_facet] = false -end - -When "I want all possible attributes" do - @options[:all_attributes] = true -end - -When /^I drill down where (\w+) is (\w+)$/ do |facet, value| - @results = results.for(facet.downcase.to_sym => value) -end - -When /^I drill down where (\w+) is (\w+) and (\w+) is (\w+)$/ do |facet_one, value_one, facet_two, value_two| - value_one = value_one.to_i unless value_one[/^\d+$/].nil? - value_two = value_two.to_i unless value_two[/^\d+$/].nil? - - @results = results.for( - facet_one.downcase.to_sym => value_one, - facet_two.downcase.to_sym => value_two - ) -end - -When /^I drill down where ([\w_]+) includes the id of tag (\w+)$/ do |facet, text| - tag = Tag.find_by_text(text) - @results = results.for(facet.downcase.to_sym => tag.id) -end - -When /^I drill down where ([\w_]+) includes the id of tags (\w+) or (\w+)$/ do |facet, text_one, text_two| - tag_one = Tag.find_by_text(text_one) - tag_two = Tag.find_by_text(text_two) - @results = results.for(facet.downcase.to_sym => [tag_one.id, tag_two.id]) -end - -Then "I should have valid facet results" do - results.should be_kind_of(Hash) - results.values.each { |value| value.should be_kind_of(Hash) } -end - -Then /^I should have (\d+) facets?$/ do |count| - results.keys.length.should == count.to_i -end - -Then /^I should have the facet ([\w_\s]+)$/ do |name| - results[facet_name(name)].should be_kind_of(Hash) -end - -Then /^I should not have the facet ([\w_\s]+)$/ do |name| - results.keys.should_not include(facet_name(name)) -end - -Then /^the ([\w_\s]+) facet should have a "([\w\s_]+)" key with (\d+) hits$/ do |name, key, hit_count| - facet_name = facet_name name - results[facet_name].keys.should include(key) - results[facet_name][key].should eql(hit_count.to_i) -end - -Then /^the ([\w_\s]+) facet should have a "(\w+)" key$/ do |name, key| - results[facet_name(name)].keys.should include(key) -end - -def facet_name(string) - string.gsub(/\s/, '').underscore.to_sym -end diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/find_arguments_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/find_arguments_steps.rb deleted file mode 100644 index 65f889c4..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/find_arguments_steps.rb +++ /dev/null @@ -1,36 +0,0 @@ -When "I include comments" do - @results = nil - @options[:include] = :comments -end - -When /^I get the first comment$/ do - @comment = Comment.find(:first) -end - -When /^I track queries$/ do - $queries_executed = [] -end - -When /^I compare comments$/ do - results.first.comments.first.should == @comment -end - -When /^I select only content$/ do - @results = nil - @options[:select] = "id, content" -end - -Then /^I should have (\d+) quer[yies]+$/ do |count| - $queries_executed.length.should == count.to_i -end - -Then /^I should not get an error accessing the subject$/ do - lambda { results.first.subject }.should_not raise_error -end - -Then /^I should get an error accessing the subject$/ do - error_class = NoMethodError - error_class = ActiveRecord::MissingAttributeError if ActiveRecord.constants.include?("MissingAttributeError") - - lambda { results.first.subject }.should raise_error(error_class) -end diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/gamma_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/gamma_steps.rb deleted file mode 100644 index c4fbe20d..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/gamma_steps.rb +++ /dev/null @@ -1,15 +0,0 @@ -When /^I destroy gamma (\w+) without callbacks$/ do |name| - @results = nil - gamma = Gamma.find_by_name(name) - Gamma.delete(gamma.id) if gamma -end - -Then "I should get a single result of nil" do - results.should == [nil] -end - -Then /^I should get a single gamma result with a name of (\w+)$/ do |name| - results.length.should == 1 - results.first.should be_kind_of(Gamma) - results.first.name.should == name -end 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 8c64dd77..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/search_steps.rb +++ /dev/null @@ -1,66 +0,0 @@ -When /^I search for the specific id of (\d+) in the (\w+) index$/ do |id, index| - @id = id.to_i - @index = index -end - -When /^I search for the document id of (\w+) (\w+) in the (\w+) index$/ do |model, name, index| - model = model.gsub(/\s/, '_').camelize.constantize - @id = model.find_by_name(name).sphinx_document_id - @index = index -end - -Then "it should exist" do - ThinkingSphinx::Search.search_for_id(@id, @index).should == true -end - -Then "it should not exist" do - ThinkingSphinx::Search.search_for_id(@id, @index).should == false -end - -Then "it should exist if using Rails 2.1 or newer" do - require 'active_record/version' - unless ActiveRecord::VERSION::STRING.to_f < 2.1 - ThinkingSphinx::Search.search_for_id(@id, @index).should == true - end -end - -Then "it should not exist if using Rails 2.1 or newer" do - require 'active_record/version' - unless ActiveRecord::VERSION::STRING.to_f < 2.1 - ThinkingSphinx::Search.search_for_id(@id, @index).should == false - end -end - -Then /^I can iterate by result and group and count$/ do - results.each_with_groupby_and_count do |result, group, count| - result.should be_kind_of(@model) - count.should be_kind_of(Integer) - group.should be_kind_of(Integer) - end -end - -Then "each result id should match the corresponding sphinx internal id" do - results.each_with_sphinx_internal_id do |result, id| - result.id.should == id - end -end - -Then "I should have an array of integers" do - results.each do |result| - result.should be_kind_of(Integer) - end -end - -Then "searching for ids should match the record ids of the normal search results" do - normal_results = results - - # reset search, switch method - @results = nil - @method = :search_for_ids - - results.should == normal_results.collect(&:id) -end - -Then /^I should get a value of (\d+)$/ do |count| - results.should == count.to_i -end \ No newline at end of file diff --git a/vendor/plugins/thinking-sphinx/features/step_definitions/sphinx_steps.rb b/vendor/plugins/thinking-sphinx/features/step_definitions/sphinx_steps.rb deleted file mode 100644 index 1633249c..00000000 --- a/vendor/plugins/thinking-sphinx/features/step_definitions/sphinx_steps.rb +++ /dev/null @@ -1,27 +0,0 @@ -Given "Sphinx is running" do - ThinkingSphinx::Configuration.instance.controller.should be_running -end - -When "I kill the Sphinx process" do - Process.kill(9, ThinkingSphinx.sphinx_pid.to_i) -end - -When "I wait for Sphinx to catch up" do - sleep(0.25) -end - -When "I start Sphinx" do - ThinkingSphinx::Configuration.instance.controller.start -end - -When "I stop Sphinx" do - ThinkingSphinx::Configuration.instance.controller.stop -end - -Then "Sphinx should be running" do - ThinkingSphinx.sphinx_running?.should be_true -end - -Then "Sphinx should not be running" do - ThinkingSphinx.sphinx_running?.should be_false -end -- cgit v1.3