Commit f4862b82 authored by Fabio Pelosin's avatar Fabio Pelosin

[Specs] Fix search related specs

parent 015670b6
...@@ -113,6 +113,10 @@ module Pod ...@@ -113,6 +113,10 @@ module Pod
@updated_search_index @updated_search_index
end end
# Allows to clear the search index.
#
attr_writer :updated_search_index
# @return [Pathname] The path where the search index should be stored. # @return [Pathname] The path where the search index should be stored.
# #
def search_index_path def search_index_path
......
...@@ -8,6 +8,7 @@ module Pod ...@@ -8,6 +8,7 @@ module Pod
before do before do
@test_source = Source.new(fixture('spec-repos/test_repo')) @test_source = Source.new(fixture('spec-repos/test_repo'))
Source::Aggregate.any_instance.stubs(:all).returns([@test_source]) Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
SourcesManager.updated_search_index = nil
end end
it "runs with correct parameters" do it "runs with correct parameters" do
......
...@@ -54,7 +54,7 @@ module Pod ...@@ -54,7 +54,7 @@ module Pod
Source::Aggregate.any_instance.stubs(:all).returns([@test_source]) Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
Source::Aggregate.any_instance.expects(:generate_search_index).returns({'BananaLib' => {}}) Source::Aggregate.any_instance.expects(:generate_search_index).returns({'BananaLib' => {}})
Source::Aggregate.any_instance.expects(:update_search_index).never Source::Aggregate.any_instance.expects(:update_search_index).never
SourcesManager.instance_variable_set("@updated_search_index", nil) SourcesManager.updated_search_index = nil
sets = SourcesManager.search_by_name('BananaLib', true) sets = SourcesManager.search_by_name('BananaLib', true)
end end
...@@ -63,7 +63,7 @@ module Pod ...@@ -63,7 +63,7 @@ module Pod
Source::Aggregate.any_instance.stubs(:all).returns([@test_source]) Source::Aggregate.any_instance.stubs(:all).returns([@test_source])
Source::Aggregate.any_instance.expects(:generate_search_index).never Source::Aggregate.any_instance.expects(:generate_search_index).never
Source::Aggregate.any_instance.expects(:update_search_index).returns({'BananaLib' => {}}) Source::Aggregate.any_instance.expects(:update_search_index).returns({'BananaLib' => {}})
SourcesManager.instance_variable_set("@updated_search_index", nil) SourcesManager.updated_search_index = nil
sets = SourcesManager.search_by_name('BananaLib', true) sets = SourcesManager.search_by_name('BananaLib', true)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment