test/unit/search_test.rb in gitdocs-0.5.0 vs test/unit/search_test.rb in gitdocs-0.6.0

- old
+ new

@@ -1,8 +1,23 @@ # -*- encoding : utf-8 -*- require File.expand_path('../test_helper', __FILE__) describe Gitdocs::Search do + describe '.search' do + subject { Gitdocs::Search.search(:term) } + before do + Gitdocs::Share.stubs(:all).returns([:share1, :share2]) + Gitdocs::Repository.stubs(:new).with(:share1).returns(:repository1) + Gitdocs::Repository.stubs(:new).with(:share2).returns(:repository2) + Gitdocs::Search + .stubs(:new) + .with([:repository1, :repository2]) + .returns(search = mock) + search.stubs(:search).with(:term).returns(:result) + end + it { subject.must_equal(:result) } + end + describe 'initialize' do subject { Gitdocs::Search.new(:repositories) } it { subject.instance_variable_get(:@repositories).must_equal :repositories } end