Permalink
Browse files

init commit of working copy

  • Loading branch information...
1 parent 46493f6 commit 377157fc9c75fc46eaa419fe955bd11876563aa0 @mkrisher committed Oct 15, 2009
View
@@ -0,0 +1,20 @@
+Copyright (c) 2009 [name of plugin creator]
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
21 README
@@ -0,0 +1,21 @@
+QunitForRails
+=============
+
+QUnit for Rails provides an easy way to run JavaScript integration testing
+against production ready HTML. QUnit for Rails simply adds an overlay menu
+at the top of an app's pages, allowing developers to run any JavaScript tests
+and view the results.
+
+To read more about QUnit:
+http://docs.jquery.com/QUnit
+
+The source for this plugin is located on Github:
+http://github.com/mkrisher/qunit_for_rails/
+
+Example
+=======
+
+To include the QUnit testing overlay on your page simply add
+<%= include_qunit %> to the head of your document layout.
+
+Copyright (c) 2009 Michael Krisher, released under the MIT license
View
@@ -0,0 +1,23 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the qunit_for_rails plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.libs << 'test'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the qunit_for_rails plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'QunitForRails'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
View
@@ -0,0 +1 @@
+TODO: convert to gem/plugin
View
@@ -0,0 +1,7 @@
+name: QUnit for Rails
+author: Michael Krisher
+version: 1.0
+description: Helper to integrate QUnit JavaScript testing into any Rails app
+url: http://github.com/mkrisher/qunit_for_rails/
+install: git@github.com:mkrisher/qunit_for_rails.git
+license: MIT
View
@@ -0,0 +1,5 @@
+require 'qunit_for_rails'
+
+ActionView::Base.send :include, QunitForRails
+
+
View
@@ -0,0 +1,21 @@
+require 'fileutils'
+
+# Install all the needed support files (CSS and JavaScript)
+js_dir = File.dirname(__FILE__) + '/../../../public/javascripts/'
+css_dir = File.dirname(__FILE__) + '/../../../public/stylesheets/'
+images_dir = File.dirname(__FILE__) + '/../../../public/images/'
+
+# install all javascript files
+FileUtils.cp File.dirname(__FILE__) + '/public/javascripts/qunit.js', js_dir unless File.exists?(js_dir + "qunit.js")
+FileUtils.cp File.dirname(__FILE__) + '/public/javascripts/qunit_for_rails.js', js_dir unless File.exists?(js_dir + "qunit_for_rails.js")
+
+# install all needed CSS
+FileUtils.cp File.dirname(__FILE__) + '/public/stylesheets/qunit_for_rails.css', css_dir unless File.exists?(css_dir + "qunit_for_rails.css")
+
+# install all image files
+FileUtils.cp File.dirname(__FILE__) + '/public/images/l_qunit.png', images_dir unless File.exists?(images_dir + "l_qunit.png")
+FileUtils.cp File.dirname(__FILE__) + '/public/images/l_qunit.png', images_dir unless File.exists?(images_dir + "i_loading_bar.gif")
+FileUtils.cp File.dirname(__FILE__) + '/public/images/l_qunit.png', images_dir unless File.exists?(images_dir + "bg_secondaryNav_right.gif")
+FileUtils.cp File.dirname(__FILE__) + '/public/images/l_qunit.png', images_dir unless File.exists?(images_dir + "bg_secondaryNav_left.gif")
+FileUtils.cp File.dirname(__FILE__) + '/public/images/l_qunit.png', images_dir unless File.exists?(images_dir + "bg_diagonalDarkBlue.gif")
+
View
@@ -0,0 +1,32 @@
+module QunitForRails
+ def include_qunit
+ # write to the head of application.html.erb
+ # include the js and css files required, if RAILS_ENV = development
+ str = "
+ <script language=\"JavaScript\">
+ $list = \"#{list_tests}\";
+ $list = $list.split(\",\");
+ $collection = \"#{collect_tests}\";
+ </script>
+ <script type=\"text/javascript\" src=\"/javascripts/qunit.js\"></script>
+ <script type=\"text/javascript\" src=\"/javascripts/qunit_for_rails.js\"></script>
+ <link href=\"/stylesheets/qunit_for_rails.css\" media=\"screen\" rel=\"stylesheet\" type=\"text/css\"/>
+ "
+ end
+
+ def collect_tests
+ response = "<select id='qunit-test-select'><option></option><option>all</option>"
+ Dir.foreach(File.dirname(__FILE__) + "/../../../../public/javascripts/tests") do |f|
+ response << "<option id='#{f}'>#{f}</option>" if f.to_s.size > 4
+ end
+ response << "</select>"
+ end
+
+ def list_tests
+ files = Dir.entries(File.dirname(__FILE__) + "/../../../../public/javascripts/tests")
+ files.delete(".")
+ files.delete("..")
+ files.join(",").to_s
+ end
+
+end
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 377157f

Please sign in to comment.