Sha256: 7a9980d6e1630357efc59dd96d20c39c71419d697fbbd475cf59539cd51b5165

Contents?: true

Size: 1.67 KB

Versions: 4

Compression:

Stored size: 1.67 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../../../unit_spec_helper")

module JsTestCore
  module Resources
    module Specs
      describe SpecFile do
        describe "GET" do
          before do
            WebRoot.dispatch_specs
          end

          describe "GET /specs/custom_suite.html" do
            it "renders the custom_suite.html file" do
              path = "#{spec_root_path}/custom_suite.html"
              mock(connection).send_head(200, 'Content-Type' => "text/html", 'Content-Length' => ::File.size(path), 'Last-Modified' => ::File.mtime(path).rfc822)
              mock(connection).send_data(::File.read(path))

              connection.receive_data("GET /specs/custom_suite.html HTTP/1.1\r\nHost: _\r\n\r\n")
            end
          end

          describe "GET /specs/foo/passing_spec" do
            it "renders a Representations::Spec with passing_spec.js as the spec file" do
              path = "#{spec_root_path}/foo/passing_spec.js"
              mock(connection).send_head(200, 'Content-Type' => "text/html", 'Last-Modified' => ::File.mtime(path).rfc822)
              mock(connection).send_data(/Content-Length: /)
              mock(connection).send_data(Regexp.new("Js Test Core Suite")) do |html|
                doc = Nokogiri::HTML(html)
                core_js_files = doc.search("script").map {|script| script["src"]}
                core_js_files.should include("/specs/foo/passing_spec.js")
                core_js_files.should_not include("/specs/foo/failing_spec.js")
              end

              connection.receive_data("GET /specs/foo/passing_spec HTTP/1.1\r\nHost: _\r\n\r\n")
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pivotal-screw-unit-0.4.0 vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_file_spec.rb
pivotal-screw-unit-0.4.1 vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_file_spec.rb
pivotal-screw-unit-0.4.2 vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_file_spec.rb
pivotal-screw-unit-0.4.3 vendor/js-test-core/spec/unit/js_test_core/resources/specs/spec_file_spec.rb