clean up rspecs

This commit is contained in:
Christian Mehlmauer
2013-08-17 12:19:54 +02:00
parent 264bc834b5
commit 81f9612de2
10 changed files with 99 additions and 85 deletions

View File

@@ -22,9 +22,8 @@ describe WpItems do
WpItem.new(uri, name: 'escaped-url') << WpItem.new(uri, name: 'escaped-url') <<
WpItem.new(uri, name: 'link-tag') << WpItem.new(uri, name: 'link-tag') <<
WpItem.new(uri, name: 'script-tag') << WpItem.new(uri, name: 'script-tag') <<
WpItem.new(uri, name: 'style-tag'), WpItem.new(uri, name: 'style-tag') <<
WpItem.new(uri, name: 'style-tag-import')
passive_detection2: WpItems.new << WpItem.new(uri, name: 'wp-table-reloaded')
} }
end end
end end

View File

@@ -23,9 +23,8 @@ describe WpPlugins do
WpPlugin.new(uri, name: 'escaped-url') << WpPlugin.new(uri, name: 'escaped-url') <<
WpPlugin.new(uri, name: 'link-tag') << WpPlugin.new(uri, name: 'link-tag') <<
WpPlugin.new(uri, name: 'script-tag') << WpPlugin.new(uri, name: 'script-tag') <<
WpPlugin.new(uri, name: 'style-tag'), WpPlugin.new(uri, name: 'style-tag') <<
WpPlugin.new(uri, name: 'style-tag-import')
passive_detection2: WpItems.new << WpItem.new(uri, name: 'wp-table-reloaded')
} }
end end
end end

View File

@@ -21,9 +21,8 @@ describe WpThemes do
passive_detection: WpThemes.new << WpTheme.new(uri, name: 'theme1') << passive_detection: WpThemes.new << WpTheme.new(uri, name: 'theme1') <<
WpTheme.new(uri, name: 'theme 2') << WpTheme.new(uri, name: 'theme 2') <<
WpTheme.new(uri, name: 'theme-3'), WpTheme.new(uri, name: 'theme-3') <<
WpTheme.new(uri, name: 'style-tag-import')
passive_detection2: WpItems.new << WpItem.new(uri, name: 'wp-table-reloaded')
} }
end end
end end

View File

@@ -1,51 +1,65 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr-FR"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr-FR">
<head profile="http://gmpg.org/xfn/11"> <head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta property="fb:page_id" content="18968879441564"/> <meta property="fb:page_id" content="18968879441564"/>
<title>Example.com</title> <title>Example.com</title>
<link rel="alternate" type="application/rss+xml" title="Example RSS Feed" href="http://example.com/feed"/> <link rel="alternate" type="application/rss+xml" title="Example RSS Feed" href="http://example.com/feed"/>
<link rel="alternate" type="application/atom+xml" title="Example Atom Feed" href="http://example.com/feed/atom"/> <link rel="alternate" type="application/atom+xml" title="Example Atom Feed" href="http://example.com/feed/atom"/>
<link rel="pingback" href="http://example.com/xmlrpc.php"/> <link rel="pingback" href="http://example.com/xmlrpc.php"/>
<link rel='stylesheet' href='http://example.com/wp-content/items/link-tag/cache/7f8155a5485bc445ed0adb136722b.css?m=1224763007' type='text/css' media='screen'/> <link rel='stylesheet'
href='http://example.com/wp-content/items/link-tag/cache/7f8155a5485bc445ed0adb136722b.css?m=1224763007'
type='text/css' media='screen'/>
<script type="text/javascript"> <script type="text/javascript">
var TB_pluginPath = 'http://www.welovebug.com/wp-content/items/js-source'; var TB_pluginPath = 'http://www.welovebug.com/wp-content/items/js-source';
var TB_config = { var TB_config = {
'widget_show_photos':true, 'widget_show_photos': true,
'widget_show_source':true, 'widget_show_source': true,
'widget_show_header':true, 'widget_show_header': true,
'general_link_screen_names':true, 'general_link_screen_names': true,
'general_link_hash_tags':true, 'general_link_hash_tags': true,
'general_link_urls':true, 'general_link_urls': true,
'widget_check_sources':true, 'widget_check_sources': true,
'widget_show_user':true 'widget_show_user': true
} }
</script> </script>
<style type="text/css"> <style type="text/css">
#fancybox-loading.fancybox-ie div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://example.com/wp-content/items/style-tag/fancybox/fancy_loading.png', sizingMethod='scale'); } #fancybox-loading.fancybox-ie div {
background: transparent;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://example.com/wp-content/items/style-tag/fancybox/fancy_loading.png', sizingMethod='scale');
}
</style> </style>
<script type='text/javascript' src='http://example.com/wp-content/items/script-tag/s2member-o.php?ws_plugin__s2member_js_w_globals=1'></script> <script type='text/javascript'
</head> src='http://example.com/wp-content/items/script-tag/s2member-o.php?ws_plugin__s2member_js_w_globals=1'></script>
<body>
<div class="top"> <style type="text/css" media="all">
/* <![CDATA[ */
@import url("https://example.com/wp-content/items/style-tag-import/css/plugin.css?ver=1.9.4");
@import url("https://example.com/wp-content/items/style-tag-import/css/datatables.css?ver=1.9.4");
/* ]]> */
</style>
</head>
<body>
<div class="top">
<div class="header"> <div class="header">
<h1 class="logo"> <h1 class="logo">
Blablabla the following plugin should not match : /wp-content/items/this-plugin-should-not-match/sub.css Blablabla the following plugin should not match : /wp-content/items/this-plugin-should-not-match/sub.css
</h1> </h1>
</div> </div>
</div> </div>
</body> </body>
<script type='text/javascript'> <script type='text/javascript'>
/* <![CDATA[ */ /* <![CDATA[ */
var pollsL10n = {"ajax_url":"http:\/\/example.com\/wp-content\/items\/escaped-url\/wp-polls.php","text_wait":"Your last request is still being processed. Please wait a while ...","text_valid":"Please choose a valid poll answer.","text_multiple":"Maximum number of choices allowed: ","show_loading":"1","show_fading":"1"}; var pollsL10n = {"ajax_url": "http:\/\/example.com\/wp-content\/items\/escaped-url\/wp-polls.php", "text_wait": "Your last request is still being processed. Please wait a while ...", "text_valid": "Please choose a valid poll answer.", "text_multiple": "Maximum number of choices allowed: ", "show_loading": "1", "show_fading": "1"};
/* ]]> */ /* ]]> */
</script> </script>
<script type='text/javascript' src='http://platform.twitter.com/widgets.js?ver=1.0.0'></script> <script type='text/javascript' src='http://platform.twitter.com/widgets.js?ver=1.0.0'></script>
<!-- a duplicate one --> <!-- a duplicate one -->
<script type='text/javascript' src='http://example.com/wp-content/items/script-tag/s2member-o.php?ws_plugin__s2member_js_w_globals=1'></script> <script type='text/javascript'
src='http://example.com/wp-content/items/script-tag/s2member-o.php?ws_plugin__s2member_js_w_globals=1'></script>
</html> </html>

View File

@@ -1,4 +0,0 @@
/* <![CDATA[ */
@import url("https://site.com/wp-content/items/wp-table-reloaded/css/plugin.css?ver=1.9.4");
@import url("https://site.com/wp-content/items/wp-table-reloaded/css/datatables.css?ver=1.9.4");
/* ]]> */

View File

@@ -1,51 +1,65 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr-FR"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr-FR">
<head profile="http://gmpg.org/xfn/11"> <head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta property="fb:page_id" content="18968879441564"/> <meta property="fb:page_id" content="18968879441564"/>
<title>Example.com</title> <title>Example.com</title>
<link rel="alternate" type="application/rss+xml" title="Example RSS Feed" href="http://example.com/feed"/> <link rel="alternate" type="application/rss+xml" title="Example RSS Feed" href="http://example.com/feed"/>
<link rel="alternate" type="application/atom+xml" title="Example Atom Feed" href="http://example.com/feed/atom"/> <link rel="alternate" type="application/atom+xml" title="Example Atom Feed" href="http://example.com/feed/atom"/>
<link rel="pingback" href="http://example.com/xmlrpc.php"/> <link rel="pingback" href="http://example.com/xmlrpc.php"/>
<link rel='stylesheet' href='http://example.com/wp-content/plugins/link-tag/cache/7f8155a5485bc445ed0adb136722b.css?m=1224763007' type='text/css' media='screen'/> <link rel='stylesheet'
href='http://example.com/wp-content/plugins/link-tag/cache/7f8155a5485bc445ed0adb136722b.css?m=1224763007'
type='text/css' media='screen'/>
<script type="text/javascript"> <script type="text/javascript">
var TB_pluginPath = 'http://www.welovebug.com/wp-content/plugins/js-source'; var TB_pluginPath = 'http://www.welovebug.com/wp-content/plugins/js-source';
var TB_config = { var TB_config = {
'widget_show_photos':true, 'widget_show_photos': true,
'widget_show_source':true, 'widget_show_source': true,
'widget_show_header':true, 'widget_show_header': true,
'general_link_screen_names':true, 'general_link_screen_names': true,
'general_link_hash_tags':true, 'general_link_hash_tags': true,
'general_link_urls':true, 'general_link_urls': true,
'widget_check_sources':true, 'widget_check_sources': true,
'widget_show_user':true 'widget_show_user': true
} }
</script> </script>
<style type="text/css"> <style type="text/css">
#fancybox-loading.fancybox-ie div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://example.com/wp-content/plugins/style-tag/fancybox/fancy_loading.png', sizingMethod='scale'); } #fancybox-loading.fancybox-ie div {
background: transparent;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://example.com/wp-content/plugins/style-tag/fancybox/fancy_loading.png', sizingMethod='scale');
}
</style> </style>
<script type='text/javascript' src='http://example.com/wp-content/plugins/script-tag/s2member-o.php?ws_plugin__s2member_js_w_globals=1'></script> <script type='text/javascript'
</head> src='http://example.com/wp-content/plugins/script-tag/s2member-o.php?ws_plugin__s2member_js_w_globals=1'></script>
<body>
<div class="top"> <style type="text/css" media="all">
/* <![CDATA[ */
@import url("https://example.com/wp-content/plugins/style-tag-import/css/plugin.css?ver=1.9.4");
@import url("https://example.com/wp-content/plugins/style-tag-import/css/datatables.css?ver=1.9.4");
/* ]]> */
</style>
</head>
<body>
<div class="top">
<div class="header"> <div class="header">
<h1 class="logo"> <h1 class="logo">
Blablabla the following plugin should not match : /wp-content/plugins/this-plugin-should-not-match/sub.css Blablabla the following plugin should not match : /wp-content/plugins/this-plugin-should-not-match/sub.css
</h1> </h1>
</div> </div>
</div> </div>
</body> </body>
<script type='text/javascript'> <script type='text/javascript'>
/* <![CDATA[ */ /* <![CDATA[ */
var pollsL10n = {"ajax_url":"http:\/\/example.com\/wp-content\/plugins\/escaped-url\/wp-polls.php","text_wait":"Your last request is still being processed. Please wait a while ...","text_valid":"Please choose a valid poll answer.","text_multiple":"Maximum number of choices allowed: ","show_loading":"1","show_fading":"1"}; var pollsL10n = {"ajax_url": "http:\/\/example.com\/wp-content\/plugins\/escaped-url\/wp-polls.php", "text_wait": "Your last request is still being processed. Please wait a while ...", "text_valid": "Please choose a valid poll answer.", "text_multiple": "Maximum number of choices allowed: ", "show_loading": "1", "show_fading": "1"};
/* ]]> */ /* ]]> */
</script> </script>
<script type='text/javascript' src='http://platform.twitter.com/widgets.js?ver=1.0.0'></script> <script type='text/javascript' src='http://platform.twitter.com/widgets.js?ver=1.0.0'></script>
<!-- a duplicate one --> <!-- a duplicate one -->
<script type='text/javascript' src='http://example.com/wp-content/plugins/script-tag/s2member-o.php?ws_plugin__s2member_js_w_globals=1'></script> <script type='text/javascript'
src='http://example.com/wp-content/plugins/script-tag/s2member-o.php?ws_plugin__s2member_js_w_globals=1'></script>
</html> </html>

View File

@@ -1,4 +0,0 @@
/* <![CDATA[ */
@import url("https://site.com/wp-content/plugins/wp-table-reloaded/css/plugin.css?ver=1.9.4");
@import url("https://site.com/wp-content/plugins/wp-table-reloaded/css/datatables.css?ver=1.9.4");
/* ]]> */

View File

@@ -8,10 +8,16 @@
<link rel="alternate" type="application/atom+xml" title="Example Atom Feed" href="http://example.com/feed/atom"/> <link rel="alternate" type="application/atom+xml" title="Example Atom Feed" href="http://example.com/feed/atom"/>
<link rel="pingback" href="http://example.com/xmlrpc.php"/> <link rel="pingback" href="http://example.com/xmlrpc.php"/>
<link type="text/css" rel="stylesheet" href="http://example.localhost/wp-content/themes/theme1/style.css" /> <link type="text/css" rel="stylesheet" href="http://example.localhost/wp-content/themes/theme1/style.css"/>
<link type="text/css" rel="stylesheet" href="http://example.localhost/wp-content/themes/theme 2/javascript.js" /> <link type="text/css" rel="stylesheet" href="http://example.localhost/wp-content/themes/theme 2/javascript.js"/>
<link type="text/css" rel="stylesheet" href="http://example.localhost/wp-content/themes/theme-3/test.png" /> <link type="text/css" rel="stylesheet" href="http://example.localhost/wp-content/themes/theme-3/test.png"/>
<style type="text/css" media="all">
/* <![CDATA[ */
@import url("https://example.com/wp-content/themes/style-tag-import/css/plugin.css?ver=1.9.4");
@import url("https://example.com/wp-content/themes/style-tag-import/css/datatables.css?ver=1.9.4");
/* ]]> */
</style>
</head> </head>
<body> <body>
<div class="top"> <div class="top">

View File

@@ -1,4 +0,0 @@
/* <![CDATA[ */
@import url("https://site.com/wp-content/themes/wp-table-reloaded/css/plugin.css?ver=1.9.4");
@import url("https://site.com/wp-content/themes/wp-table-reloaded/css/datatables.css?ver=1.9.4");
/* ]]> */

View File

@@ -155,11 +155,6 @@ shared_examples 'WpItems::Detectable' do
@fixture = fixtures_dir + '/passive_detection.html' @fixture = fixtures_dir + '/passive_detection.html'
@expected = expected[:passive_detection] @expected = expected[:passive_detection]
end end
it 'returns the expected items' do
@fixture = fixtures_dir + '/passive_detection_2.html'
@expected = expected[:passive_detection2]
end
end end
end end