At this point in time, I can offer two options.. the first is some
rspec matchers:
http://openmonkey.com/articles/2009/07/thinking-sphinx-rspec-matchers
The second is a starting point for cucumber:
# from env.rb -- make sure you disable transactional fixtures, as well.
ThinkingSphinx.deltas_enabled = true
ThinkingSphinx.updates_enabled = true
ThinkingSphinx.suppress_delta_output = true
FileUtils.mkdir_p
ThinkingSphinx::Configuration.instance.searchd_file_path
ThinkingSphinx::Configuration.instance.build
ThinkingSphinx::Configuration.instance.controller.index
ThinkingSphinx::Configuration.instance.controller.start
at_exit do
ThinkingSphinx::Configuration.instance.controller.stop
end
# from common_steps.rb
Before do
# Because we're not using transactions (Sphinx needs data in tables)
%w( table names go here ).each do |table|
ActiveRecord::Base.connection.execute "TRUNCATE TABLE #{table}"
end
# Let's not store emails between scenarios
ActionMailer::Base.deliveries.clear
end
Given 'the Sphinx indexes are updated' do
ThinkingSphinx::Configuration.instance.controller.index
sleep(0.25)
end
It's still far from perfect, but it's a start.
--
Pat
On 27/08/2009, at 3:53 PM, mix wrote:
>
> Unfortunately i've to test also the object returned because i'm using
> a method which does some logic stuff and then call the sphinx search,
> and i'd be a lot better testing the results too (having them ordered
> by a specific column i haven't the risk of the change of the sphinx
> ranking algorithm).
> Do you know if (and how) to test results too? With the possibility to
> rebuild the index at the begin of a unit test (would the delta indexes
> solve this?).
>
> (@Pat, if you're reading it would be great an answer from you too :) )
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en
-~----------~----~----~----~------~----~------~--~---