Sha256: c142537b6c92ad023159433a8a430bf8e15dd19b6d7660de90d05fa758f94960

Contents?: true

Size: 1.51 KB

Versions: 15

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe Jasmine::Server do
  describe "rack ~> 1.0" do
    before do
      Jasmine::Dependencies.stub(:legacy_rack?).and_return(true)
    end

    it "should run the handler with the application" do
      server = double(:server)
      port = 1234
      application = double(:application)
      Rack::Handler.should_receive(:get).with("webrick").and_return(server)
      server.should_receive(:run).with(application, hash_including(:Port => port))
      Jasmine::Server.new(port, application).start
    end
  end

  describe "rack >= 1.1" do
    before do
      Jasmine::Dependencies.stub(:legacy_rack?).and_return(false)
      if !Rack.constants.include?(:Server)
        Rack::Server = double("Rack::Server")
      end
    end

    it "should create a Rack::Server with the correct port when passed" do
      port = 1234
      Rack::Server.should_receive(:new).with(hash_including(:Port => port)).and_return(double(:server).as_null_object)
      Jasmine::Server.new(port).start
    end

    it "should start the server" do
      server = double(:server)
      Rack::Server.should_receive(:new) { server.as_null_object }
      server.should_receive(:start)
      Jasmine::Server.new.start
    end

    it "should set the app as the instance variable on the rack server" do
      app = double('application')
      server = double(:server)
      Rack::Server.should_receive(:new) { server.as_null_object }
      Jasmine::Server.new(1234, app).start
      server.instance_variable_get(:@app).should == app
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
rally-jasmine-1.2.0.18 spec/server_spec.rb
rally-jasmine-1.2.0.12 spec/server_spec.rb
rally-jasmine-1.2.0.11 spec/server_spec.rb
rally-jasmine-1.2.0.10 spec/server_spec.rb
rally-jasmine-1.2.0.8 spec/server_spec.rb
jasmine-1.3.0 spec/server_spec.rb
rally-jasmine-1.2.0.7 spec/server_spec.rb
rally-jasmine-1.2.0.6 spec/server_spec.rb
rally-jasmine-1.2.0.5 spec/server_spec.rb
rally-jasmine-1.2.0.4 spec/server_spec.rb
rally-jasmine-1.2.0.3 spec/server_spec.rb
rally-jasmine-1.2.0.2 spec/server_spec.rb
rally-jasmine-1.2.0.1 spec/server_spec.rb
rally-jasmine-1.2.0 spec/server_spec.rb
jasmine-1.2.1 spec/server_spec.rb