Sha256: a20bac6b2c16b8e58da7bdaa923cf83245d5c34d6adad804e5d2c73b5c8942b6

Contents?: true

Size: 1.37 KB

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
innate-2023.01.06 spec/innate/modes.rb