Sha256: e0ec5c96120649667206ef0fad9fd1bb19e38c9254a9dcc323bdfe27ccced5fe
Contents?: true
Size: 912 Bytes
Versions: 11
Compression:
Stored size: 912 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../snippets_spec_helper.rb') class TestSnippetFinder; end class AlternateSnippetFinder; end describe 'SnippetFinder' do it 'finds a snippet by name in the first finder type' do SnippetFinder.stub!(:finder_types).and_return([TestSnippetFinder, AlternateSnippetFinder]) TestSnippetFinder.should_receive(:find_by_name).and_return(OpenStruct.new(:name => 'test_snippet')) SnippetFinder.find_by_name('test_snippet') end it 'finds a snippet by name in the next finder type after no result from the previous' do SnippetFinder.stub!(:finder_types).and_return([TestSnippetFinder, AlternateSnippetFinder]) TestSnippetFinder.stub!(:find_by_name).and_return(nil) AlternateSnippetFinder.should_receive(:find_by_name).and_return(OpenStruct.new(:name => 'alternate_snippet')) SnippetFinder.find_by_name('alternate_snippet') end end
Version data entries
11 entries across 11 versions & 2 rubygems