Sha256: bea09b7ed50ee3f12dfda9c7f166cd9d8a8505915ef001a570310d24090e5779

Contents?: true

Size: 1.36 KB

Versions: 17

Compression:

Stored size: 1.36 KB

Contents

require "test_helper"
require "jstdutil/cli"
require "fileutils"

class JstdutilCliTest < Test::Unit::TestCase
  context "running the cli" do
    should "run jstestdriver command through JsRedGreen with given jar" do
      jar = "path/to.jar"
      result = "REPORT"
      Jstdutil.expects(:run).with("--tests all ", jar).returns(result)
      Jstdutil::Formatter.expects(:format).with(result, Jstdutil::RedGreen).returns(result * 2)

      assert_equal result * 2, Jstdutil::Cli.run("--tests all --jar #{jar}".split(" "))
    end

    should "run jstestdriver command through JsRedGreen with jar from env" do
      jar = "path/to.jar"
      result = "REPORT"
      Jstdutil.expects(:jar).returns(jar)
      Jstdutil.expects(:run).with("--tests all", jar).returns(result)
      Jstdutil::Formatter.expects(:format).with(result, Jstdutil::RedGreen).returns(result * 2)

      assert_equal result * 2, Jstdutil::Cli.run("--tests all".split(" "))
    end
    
    should "run jstestdriver command through JsColorfulHtml with --html" do
      jar = "path/to.jar"
      result = "REPORT"
      Jstdutil.expects(:jar).returns(jar)
      Jstdutil.expects(:run).with("--tests all ", jar).returns(result)
      Jstdutil::Formatter.expects(:format).with(result, Jstdutil::ColorfulHtml).returns(result * 2)

      assert_equal result * 2, Jstdutil::Cli.run("--tests all --html".split(" "))
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
jstdutil-0.3.13 test/cli_test.rb
jstdutil-0.3.12 test/cli_test.rb
jstdutil-0.3.11 test/cli_test.rb
jstdutil-0.3.10 test/cli_test.rb
jstdutil-0.3.9 test/cli_test.rb
jstdutil-0.3.8 test/cli_test.rb
jstdutil-0.3.7 test/cli_test.rb
jstdutil-0.3.6 test/cli_test.rb
jstdutil-0.3.5 test/cli_test.rb
jstdutil-0.3.4 test/cli_test.rb
jstdutil-0.3.3 test/cli_test.rb
jstdutil-0.3.2 test/cli_test.rb
jstdutil-0.3.1 test/cli_test.rb
jstdutil-0.3.0 test/cli_test.rb
jstdutil-0.2.2 test/cli_test.rb
jstdutil-0.2.1 test/cli_test.rb
jstdutil-0.2.0 test/cli_test.rb