Removes the theme version check from the readme, unrealistic scenario - Ref #737

This commit is contained in:
erwanlr
2014-12-10 17:01:14 +01:00
parent e09b4cc76d
commit e3ac331a71
2 changed files with 4 additions and 29 deletions

View File

@@ -2,16 +2,8 @@
class WpTheme < WpItem class WpTheme < WpItem
module Versionable module Versionable
def version def version
unless @version @version ||= Browser.get(style_url).body[%r{Version:\s*([^\s]+)}i, 1]
@version = Browser.get(style_url).body[%r{Version:\s*([^\s]+)}i, 1] end
# Get Version from readme.txt
@version ||= super
end
@version
end
end end
end end

View File

@@ -21,28 +21,11 @@ shared_examples 'WpTheme::Versionable' do
end end
context 'when the version is not found' do context 'when the version is not found' do
let(:file) { 'twentyeleven-unknow.css' }
let(:readme_url) { subject.uri.merge('readme.txt').to_s }
context 'from the style_url' do
it 'gets it from the readme' do
stub_request(:get, readme_url).to_return(status: 200, body: 'Stable Tag: 1.3.4')
@file = file
@expected = '1.3.4'
end
end
context 'from both style & readme' do
it 'returns nil' do it 'returns nil' do
allow(subject).to receive_messages(readme_url: readme_url) @file = 'twentyeleven-unknow.css'
stub_request(:get, readme_url).to_return(status: 404)
@file = file
@expected = nil @expected = nil
end end
end end
end
context 'when the stylesheet is inline' do context 'when the stylesheet is inline' do
it 'returns the correct version' do it 'returns the correct version' do