diff --git a/features/browse.feature b/features/browse.feature index 10bb97c..3408a40 100644 --- a/features/browse.feature +++ b/features/browse.feature @@ -4,6 +4,7 @@ Feature: browse Background: Given I am on the homepage + And the search index is empty And the following users | login | name | | joaosilva | Joao Silva | diff --git a/features/profile_search.feature b/features/profile_search.feature index 924df22..3249e00 100644 --- a/features/profile_search.feature +++ b/features/profile_search.feature @@ -4,7 +4,8 @@ Feature: search inside a profile In order to find stuff from a profile Background: - Given the following users + Given the search index is empty + And the following users | login | name | | joaosilva | Joao Silva | And the following articles diff --git a/features/search.feature b/features/search.feature index 932d843..e7aaf38 100644 --- a/features/search.feature +++ b/features/search.feature @@ -3,6 +3,9 @@ Feature: search I want to search In order to find stuff + Background: + Given the search index is empty + Scenario: simple search for person Given the following users | login | name | diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index 1591c73..a7a98fa 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -411,3 +411,9 @@ Given /^the environment domain is "([^\"]*)"$/ do |domain| d = Domain.new :name => domain, :owner => Environment.default d.save(false) end + +Given /^the search index is empty$/ do + ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => '*:*')) +end + + diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake index d1f8faa..6df754e 100644 --- a/lib/tasks/cucumber.rake +++ b/lib/tasks/cucumber.rake @@ -11,6 +11,11 @@ begin vendored_cucumber_binary = Dir["#{RAILS_ROOT}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first namespace :cucumber do + Cucumber::Rake::Task.new({:solr_start => 'solr:start'}, 'Run solr before') do |t| + Rake::Task['solr:start'].invoke +# ENV['RAILS_ENV'] = 'cucumber' + end + Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| t.binary = vendored_cucumber_binary t.fork = true # You may get faster startup if you set this to false @@ -29,8 +34,12 @@ begin t.cucumber_opts = "--color -p selenium --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}" end + Cucumber::Rake::Task.new({:solr_stop => 'solr:stop'}, 'Run solr after') do |t| + end + desc 'Run all features' - task :all => [:ok, :wip] + task :all => [:solr_start, :ok, :wip, :solr_stop] do + end end desc 'Alias for cucumber:ok' task :cucumber => 'cucumber:ok' -- libgit2 0.21.2