Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test for app loading in unit tests

  • Loading branch information...
commit f991d7b1c4c22b81b3c8550d064f3fbd76dcc13b 1 parent 23accc3
twinturbo authored
Showing with 28 additions and 3 deletions.
  1. +3 −2 lib/iridium/unit_test_runner.rb
  2. +25 −1 test/unit_test_runner_test.rb
View
5 lib/iridium/unit_test_runner.rb
@@ -89,8 +89,9 @@ def default_template
<script src="application.js"></script>
- <script language="text/javascript">
- minispade.require('<%= app.class.to_s.underscore %>/app')
+ <script type="text/javascript">
+ minispade.require('<%= app.class.to_s.underscore %>/app');
+ </script>
</body>
</html>
str
View
26 test/unit_test_runner_test.rb
@@ -4,12 +4,22 @@ class UnitTestRunnerTest < MiniTest::Unit::TestCase
def setup
super
+ Iridium.application.config.load :minispade
+
File.open Iridium.application.root.join('test', 'support', 'qunit.js'), "w" do |qunit|
qunit.puts File.read(File.expand_path("../fixtures/qunit.js", __FILE__))
end
+ File.open Iridium.application.site_path.join("minispade.js"), "w" do |file|
+ file.puts File.read(File.expand_path('../fixtures/minispade.js', __FILE__))
+ end
+
File.open Iridium.application.site_path.join('application.js'), "w" do |file|
- file.puts "var foo = {};"
+ file.puts <<-code
+ minispade.register('test_app/app', function() {
+ window.appLoaded = true;
+ })
+ code
end
end
@@ -289,4 +299,18 @@ class Helper
invoke "test/success.js"
end
end
+
+ def test_app_module_is_required
+ create_file "test/helper.coffee", test_helper
+ create_file "test/module_test.coffee", <<-test
+ test 'minispade modules are required', ->
+ ok window.appLoaded, "test_app/app should be required!"
+ test
+
+ results, stdout, stderr = invoke "test/module_test.coffee"
+
+ assert_kind_of Array, results
+ assert_equal 1, results.size
+ assert results.first.passed?
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.