Permalink
Browse files

Adding specs for ThinkingSphinx::Deltas::Job, and added direct attrib…

…ute feature file to cucumber profiles.
  • Loading branch information...
1 parent dd6777f commit 7ab73a90a39391396ba93268969a6a4c7537f51d @pat pat committed Oct 12, 2009
Showing with 34 additions and 2 deletions.
  1. +2 −2 cucumber.yml
  2. +32 −0 spec/lib/thinking_sphinx/deltas/job_spec.rb
View
@@ -1,5 +1,5 @@
default: "--require features/support/env.rb --require features/support/db/mysql.rb --require features/support/db/active_record.rb --require features/support/post_database.rb --require features/step_definitions/alpha_steps.rb --require features/step_definitions/beta_steps.rb --require features/step_definitions/common_steps.rb --require features/step_definitions/datetime_delta_steps.rb --require features/step_definitions/delayed_delta_indexing_steps.rb --require features/step_definitions/extensible_delta_indexing_steps.rb --require features/step_definitions/facet_steps.rb --require features/step_definitions/find_arguments_steps.rb --require features/step_definitions/gamma_steps.rb --require features/step_definitions/scope_steps.rb --require features/step_definitions/search_steps.rb --require features/step_definitions/sphinx_steps.rb"
-mysql: "--require features/support/env.rb --require features/support/db/mysql.rb --require features/support/db/active_record.rb --require features/support/post_database.rb --require features/step_definitions/alpha_steps.rb --require features/step_definitions/beta_steps.rb --require features/step_definitions/common_steps.rb --require features/step_definitions/datetime_delta_steps.rb --require features/step_definitions/delayed_delta_indexing_steps.rb --require features/step_definitions/extensible_delta_indexing_steps.rb --require features/step_definitions/facet_steps.rb --require features/step_definitions/find_arguments_steps.rb --require features/step_definitions/gamma_steps.rb --require features/step_definitions/scope_steps.rb --require features/step_definitions/search_steps.rb --require features/step_definitions/sphinx_steps.rb features/alternate_primary_key.feature features/attribute_transformation.feature features/attribute_updates.feature features/datetime_deltas.feature features/delayed_delta_indexing.feature features/deleting_instances.feature features/excerpts.feature features/extensible_delta_indexing.feature features/facets.feature features/facets_across_model.feature features/handling_edits.feature features/retry_stale_indexes.feature features/searching_across_models.feature features/searching_by_model.feature features/searching_with_find_arguments.feature features/sphinx_detection.feature features/sphinx_scopes.feature features/sti_searching.feature"
+mysql: "--require features/support/env.rb --require features/support/db/mysql.rb --require features/support/db/active_record.rb --require features/support/post_database.rb --require features/step_definitions/alpha_steps.rb --require features/step_definitions/beta_steps.rb --require features/step_definitions/common_steps.rb --require features/step_definitions/datetime_delta_steps.rb --require features/step_definitions/delayed_delta_indexing_steps.rb --require features/step_definitions/extensible_delta_indexing_steps.rb --require features/step_definitions/facet_steps.rb --require features/step_definitions/find_arguments_steps.rb --require features/step_definitions/gamma_steps.rb --require features/step_definitions/scope_steps.rb --require features/step_definitions/search_steps.rb --require features/step_definitions/sphinx_steps.rb features/alternate_primary_key.feature features/attribute_transformation.feature features/attribute_updates.feature features/datetime_deltas.feature features/delayed_delta_indexing.feature features/deleting_instances.feature features/direct_attributes.feature features/excerpts.feature features/extensible_delta_indexing.feature features/facets.feature features/facets_across_model.feature features/handling_edits.feature features/retry_stale_indexes.feature features/searching_across_models.feature features/searching_by_model.feature features/searching_with_find_arguments.feature features/sphinx_detection.feature features/sphinx_scopes.feature features/sti_searching.feature"
-postgresql: "--require features/support/env.rb --require features/support/db/postgresql.rb --require features/support/db/active_record.rb --require features/support/post_database.rb --require features/step_definitions/alpha_steps.rb --require features/step_definitions/beta_steps.rb --require features/step_definitions/common_steps.rb --require features/step_definitions/datetime_delta_steps.rb --require features/step_definitions/delayed_delta_indexing_steps.rb --require features/step_definitions/extensible_delta_indexing_steps.rb --require features/step_definitions/facet_steps.rb --require features/step_definitions/find_arguments_steps.rb --require features/step_definitions/gamma_steps.rb --require features/step_definitions/scope_steps.rb --require features/step_definitions/search_steps.rb --require features/step_definitions/sphinx_steps.rb features/alternate_primary_key.feature features/attribute_transformation.feature features/attribute_updates.feature features/datetime_deltas.feature features/delayed_delta_indexing.feature features/deleting_instances.feature features/excerpts.feature features/extensible_delta_indexing.feature features/facets.feature features/facets_across_model.feature features/handling_edits.feature features/retry_stale_indexes.feature features/searching_across_models.feature features/searching_by_model.feature features/searching_with_find_arguments.feature features/sphinx_detection.feature features/sphinx_scopes.feature features/sti_searching.feature"
+postgresql: "--require features/support/env.rb --require features/support/db/postgresql.rb --require features/support/db/active_record.rb --require features/support/post_database.rb --require features/step_definitions/alpha_steps.rb --require features/step_definitions/beta_steps.rb --require features/step_definitions/common_steps.rb --require features/step_definitions/datetime_delta_steps.rb --require features/step_definitions/delayed_delta_indexing_steps.rb --require features/step_definitions/extensible_delta_indexing_steps.rb --require features/step_definitions/facet_steps.rb --require features/step_definitions/find_arguments_steps.rb --require features/step_definitions/gamma_steps.rb --require features/step_definitions/scope_steps.rb --require features/step_definitions/search_steps.rb --require features/step_definitions/sphinx_steps.rb features/alternate_primary_key.feature features/attribute_transformation.feature features/attribute_updates.feature features/datetime_deltas.feature features/delayed_delta_indexing.feature features/deleting_instances.feature features/direct_attributes.feature features/excerpts.feature features/extensible_delta_indexing.feature features/facets.feature features/facets_across_model.feature features/handling_edits.feature features/retry_stale_indexes.feature features/searching_across_models.feature features/searching_by_model.feature features/searching_with_find_arguments.feature features/sphinx_detection.feature features/sphinx_scopes.feature features/sti_searching.feature"
@@ -0,0 +1,32 @@
+require 'spec/spec_helper'
+
+describe ThinkingSphinx::Deltas::Job do
+ describe '.cancel_thinking_sphinx_jobs' do
+ before :each do
+ ThinkingSphinx::Deltas::Job.stub!(:delete_all => true)
+ end
+
+ it "should not delete any rows if the delayed_jobs table does not exist" do
+ ThinkingSphinx::Deltas::Job.connection.stub!(:tables => [])
+ ThinkingSphinx::Deltas::Job.should_not_receive(:delete_all)
+
+ ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
+ end
+
+ it "should delete rows if the delayed_jobs table does exist" do
+ ThinkingSphinx::Deltas::Job.connection.stub!(:tables => ['delayed_jobs'])
+ ThinkingSphinx::Deltas::Job.should_receive(:delete_all)
+
+ ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
+ end
+
+ it "should delete only Thinking Sphinx jobs" do
+ ThinkingSphinx::Deltas::Job.connection.stub!(:tables => ['delayed_jobs'])
+ ThinkingSphinx::Deltas::Job.should_receive(:delete_all) do |sql|
+ sql.should match(/handler LIKE '--- !ruby\/object:ThinkingSphinx::Deltas::\%'/)
+ end
+
+ ThinkingSphinx::Deltas::Job.cancel_thinking_sphinx_jobs
+ end
+ end
+end

0 comments on commit 7ab73a9

Please sign in to comment.