Sha256: 8727b67fca98282cfd9d73c0495d529e96278135628ce870bc5435cc7cf9b184

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

module Rack
  describe Webconsole do

    it 'initializes with an app' do
      @app = stub
      @webconsole = Webconsole.new(@app)

      @webconsole.instance_variable_get(:@app).must_equal @app
    end

    describe "#call" do
      it 'delegates the call to the Repl middleware when the path is /webconsole' do
        @app = stub
        @webconsole = Webconsole.new(@app)
        @env = {'PATH_INFO' => '/webconsole'}

        repl = stub
        Webconsole::Repl.expects(:new).with(@app).returns repl
        repl.expects(:call).with @env

        @webconsole.call(@env)
      end

      it 'passes the call to the Assets middleware otherwise' do
        @app = stub
        @webconsole = Webconsole.new(@app)
        @env = {'PATH_INFO' => '/whatever'}

        assets = stub
        Webconsole::Assets.expects(:new).with(@app).returns assets
        assets.expects(:call).with @env

        @webconsole.call(@env)
      end
    end

    describe 'class methods' do
      it '#inject_jquery accessors' do
        Webconsole.inject_jquery.must_equal false
        Webconsole.inject_jquery = true
        Webconsole.inject_jquery.must_equal true
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rack-webconsole-0.1.2 spec/rack/webconsole_spec.rb
rack-webconsole-0.1.1 spec/rack/webconsole_spec.rb
rack-webconsole-0.1.0 spec/rack/webconsole_spec.rb
rack-webconsole-0.0.5 spec/rack/webconsole_spec.rb
rack-webconsole-0.0.4 spec/rack/webconsole_spec.rb
rack-webconsole-0.0.3 spec/rack/webconsole_spec.rb