Sha256: 0a6702179469ead723d6cf23b3e057389724f8f7bde86ed1facc8d3c74b81bef

Contents?: true

Size: 1.37 KB

Versions: 17

Compression:

Stored size: 1.37 KB

Contents

require File.expand_path('../../helper', __FILE__)

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

17 entries across 17 versions & 2 rubygems

Version Path
innate-2015.10.28 spec/innate/modes.rb
manveru-innate-2009.07 spec/innate/modes.rb
innate-2013.02.21 spec/innate/modes.rb
innate-2013.02 spec/innate/modes.rb
innate-2012.12 spec/innate/modes.rb
innate-2012.03 spec/innate/modes.rb
innate-2011.12 spec/innate/modes.rb
innate-2011.10 spec/innate/modes.rb
innate-2011.04 spec/innate/modes.rb
innate-2011.01 spec/innate/modes.rb
innate-2010.07 spec/innate/modes.rb
innate-2010.06.18 spec/innate/modes.rb
innate-2010.04 spec/innate/modes.rb
innate-2010.03 spec/innate/modes.rb
innate-2010.01 spec/innate/modes.rb
innate-2009.10 spec/innate/modes.rb
innate-2009.07 spec/innate/modes.rb