Sha256: 95af920681a3adf8e95c3fa64230a74a3ec912aa0cd0b9b829a520eadfa0e1e8

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

require 'spec/helper'

class SpecModeDummy
  Innate.node '/'

  def index
    'Hello, World!'
  end

  def random
    rand.to_s
  end
end

describe 'Innate modes' do
  describe 'dev' do
    behaves_like :rack_test
    Innate.options.mode = :dev

    should 'handle GET request' do
      get('/').status.
        should == 200
      last_response.headers.
        should == {'Content-Length' => '13', 'Content-Type' => 'text/html'}
      last_response.body.
        should == 'Hello, World!'
    end

    should 'handle HEAD requests by omitting body' do
      head('/').status.
        should == 200
      last_response.headers.
        should == {'Content-Length' => '13', 'Content-Type' => 'text/html'}
      last_response.body.
        should == ''
    end
  end

  describe 'live' do
    behaves_like :rack_test
    Innate.options.mode = :live

    should 'handle GET request' do
      get('/').status.
        should == 200
      last_response.headers.
        should == {'Content-Length' => '13', 'Content-Type' => 'text/html'}
      last_response.body.
        should == 'Hello, World!'
    end

    should 'handle HEAD requests by omitting body' do
      head('/').status.
        should == 200
      last_response.headers.
        should == {'Content-Length' => '13', 'Content-Type' => 'text/html'}
      last_response.body.
        should == ''
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
manveru-innate-2009.06.12 spec/innate/modes.rb
manveru-innate-2009.06 spec/innate/modes.rb
rjspotter-innate-2009.06.29 spec/innate/modes.rb
rjspotter-innate-2009.06.30 spec/innate/modes.rb
rjspotter-innate-2009.06.31 spec/innate/modes.rb
innate-2009.06 spec/innate/modes.rb
innate-2009.06.12 spec/innate/modes.rb