HELLO v3!!!
This commit is contained in:
45
spec/shared_examples/finders/wp_items/urls_in_homepage.rb
Normal file
45
spec/shared_examples/finders/wp_items/urls_in_homepage.rb
Normal file
@@ -0,0 +1,45 @@
|
||||
shared_examples 'App::Finders::WpItems::URLsInHomepage' do
|
||||
before do
|
||||
stub_request(:get, finder.target.url).to_return(body: File.read(File.join(fixtures, file)))
|
||||
end
|
||||
|
||||
describe '#items_from_links' do
|
||||
context 'when none found' do
|
||||
let(:file) { 'none.html' }
|
||||
|
||||
it 'returns an empty array' do
|
||||
expect(finder.items_from_links(type)).to eql([])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when found' do
|
||||
let(:file) { 'found.html' }
|
||||
|
||||
it 'returns the expected array' do
|
||||
expect(finder.target).to receive(:content_dir).at_least(1).and_return('wp-content')
|
||||
|
||||
expect(finder.items_from_links(type, uniq_links)).to eql expected_from_links
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#items_from_codes' do
|
||||
before { expect(finder.target).to receive(:content_dir).at_least(1).and_return('wp-content') }
|
||||
|
||||
context 'when none found' do
|
||||
let(:file) { 'none.html' }
|
||||
|
||||
it 'returns an empty array' do
|
||||
expect(finder.items_from_codes(type)).to eql([])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when found' do
|
||||
let(:file) { 'found.html' }
|
||||
|
||||
it 'returns the expected array' do
|
||||
expect(finder.items_from_codes(type, uniq_codes)).to eql expected_from_codes
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user