diff --git a/plugins/solr/features/step_definitions/solr_steps.rb b/plugins/solr/features/step_definitions/solr_steps.rb new file mode 100644 index 0000000..403febe --- /dev/null +++ b/plugins/solr/features/step_definitions/solr_steps.rb @@ -0,0 +1,18 @@ +Given /^the search index is empty$/ do + ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => '*:*')) +end + +# This could be merged with "the following categories" +Given /^the following categories as facets$/ do |table| + ids = [] + table.hashes.each do |item| + cat = Category.find_by_name(item[:name]) + if cat.nil? + cat = Category.create!(:environment_id => Environment.default.id, :name => item[:name]) + end + ids << cat.id + end + env = Environment.default + env.top_level_category_as_facet_ids = ids + env.save! +end diff --git a/plugins/solr/features/steps/solr_steps.rb b/plugins/solr/features/steps/solr_steps.rb deleted file mode 100644 index 403febe..0000000 --- a/plugins/solr/features/steps/solr_steps.rb +++ /dev/null @@ -1,18 +0,0 @@ -Given /^the search index is empty$/ do - ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => '*:*')) -end - -# This could be merged with "the following categories" -Given /^the following categories as facets$/ do |table| - ids = [] - table.hashes.each do |item| - cat = Category.find_by_name(item[:name]) - if cat.nil? - cat = Category.create!(:environment_id => Environment.default.id, :name => item[:name]) - end - ids << cat.id - end - env = Environment.default - env.top_level_category_as_facet_ids = ids - env.save! -end -- libgit2 0.21.2