WpItem::Findable#Found_From= specs
This commit is contained in:
@@ -4,6 +4,7 @@ require 'spec_helper'
|
||||
|
||||
describe WpItem do
|
||||
it_behaves_like 'WpItem::Existable'
|
||||
it_behaves_like 'WpItem::Findable#Found_From='
|
||||
|
||||
subject(:wp_item) { WpItem.new(uri, options) }
|
||||
let(:uri) { URI.parse('http://example.com') }
|
||||
|
||||
23
spec/shared_examples/wp_item_findable_found_from.rb
Normal file
23
spec/shared_examples/wp_item_findable_found_from.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
shared_examples 'WpItem::Findable#Found_From=' do
|
||||
|
||||
describe '#found_from=' do
|
||||
after do
|
||||
subject.found_from = @method
|
||||
subject.found_from.should == @expected
|
||||
end
|
||||
context 'when the pattern is not found' do
|
||||
it 'returns nil' do
|
||||
@method = 'I_do_not_match'
|
||||
@expected = nil
|
||||
end
|
||||
end
|
||||
|
||||
it 'replaces _ by space' do
|
||||
@method = 'find_from_some_detection_method'
|
||||
@expected = 'some detection method'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user