]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1709:
authorGodin <mandrikov@gmail.com>
Mon, 27 Sep 2010 10:09:23 +0000 (10:09 +0000)
committerGodin <mandrikov@gmail.com>
Mon, 27 Sep 2010 10:09:23 +0000 (10:09 +0000)
* Add ruby-helper for URL construction for static resources from plugins
* Add integration test

sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
tests/integration/reference-plugin/src/main/resources/static/file.html [new file with mode: 0644]
tests/integration/tests/src/it/selenium/SONAR-1709-static-resources.html [new file with mode: 0644]

index f8997db4be1d228efffddc6c66fb3d4f1965ec16..bb1934c9e3f645c1dd3b9025085e753a951da7a3 100644 (file)
@@ -144,6 +144,15 @@ module ApplicationHelper
     Metric.by_key(key)
   end
 
+  # URL to static resource from plugin.
+  #
+  # === Examples
+  #
+  #   url_for_static(:plugin => 'myplugin', :path => 'image.png')
+  def url_for_static(options={})
+    "#{ApplicationController.root_context}/static/#{options[:plugin]}/#{options[:path]}"
+  end
+
   def url_for_gwt(page)
     "#{ApplicationController.root_context}/plugins/home/#{page}"
   end
diff --git a/tests/integration/reference-plugin/src/main/resources/static/file.html b/tests/integration/reference-plugin/src/main/resources/static/file.html
new file mode 100644 (file)
index 0000000..5ae990c
--- /dev/null
@@ -0,0 +1,5 @@
+<html>\r
+<body>\r
+Text from static resource\r
+</body>\r
+</html>\r
diff --git a/tests/integration/tests/src/it/selenium/SONAR-1709-static-resources.html b/tests/integration/tests/src/it/selenium/SONAR-1709-static-resources.html
new file mode 100644 (file)
index 0000000..b172c2a
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>SONAR-1709-static-resources</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">SONAR-1709-static-resources</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/static/reference-plugin/file.html</td>
+       <td></td>
+</tr>
+<tr>
+       <td>assertText</td>
+       <td>//body</td>
+       <td>Text from static resource</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>