Sha256: 8dcffc29eae19422eed8ed133c093ea027815d765935d54e6f9644ea65df8cef

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

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

module JsTestCore
  module Resources
    describe WebRoot do
      attr_reader :web_root
      before(:each) do
        @web_root = WebRoot.new(:connection => connection, :public_path => public_path)
      end

      describe "GET /stylesheets" do
        it "returns a page with a of files in the directory" do
          mock(connection).send_head()
          mock(connection).send_body(Regexp.new('<a href="example.css">example.css</a>'))

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

      describe "GET /stylesheets/example.css" do
        it "returns a page with a of files in the directory" do
          path = "#{public_path}/stylesheets/example.css"
          mock(connection).send_head(200, 'Content-Type' => "text/css", 'Content-Length' => ::File.size(path), 'Last-Modified' => ::File.mtime(path).rfc822)
          mock(connection).send_data(::File.read(path))
          stub(EventMachine).close_connection

          connection.receive_data("GET /stylesheets/example.css HTTP/1.1\r\nHost: _\r\n\r\n")
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 4 rubygems

Version Path
pivotal-screw-unit-0.4.0 vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb
pivotal-screw-unit-0.4.1 vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb
pivotal-screw-unit-0.4.2 vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb
pivotal-screw-unit-0.4.3 vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb
js_spec-0.3.2 vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb
js_spec-0.3.3 vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb
js_test_core-0.2.0 spec/unit/js_test_core/resources/web_root_spec.rb
screw-unit-0.3.1 vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb
screw-unit-0.3.3 vendor/js-test-core/spec/unit/js_test_core/resources/web_root_spec.rb