Sha256: d577f58e2d25f5fef1cff0b00d109f7862bca6adb8e1a973b8433cb685fa05b6

Contents?: true

Size: 896 Bytes

Versions: 1

Compression:

Stored size: 896 Bytes

Contents

require File.join(File.dirname(__FILE__), '/../', 'spec_helper')

include Rack::Test::Methods

describe Gurk::Router do

  before do
    @router = Gurk::Router.new
  end

  def app
    @router
  end

  it 'returns a valid instance' do
    expect(@router).to be_instance_of Gurk::Router
  end

  it 'returns a valid http_router instance' do
    expect(@router.http_router).to be_instance_of HttpRouter
  end

  it 'adds a page with a valid content' do
    page = Gurk::Page.new({name: 'about', path: '/about', locals: {title: 'lalala'}})

    @router.add page

    request "/about"

    expect(last_response.status).to eq(200)
  end

  it 'adds a page with a valid content with params' do

    page = Gurk::Page.new({name: 'about', path: '/pages/slug', locals: {title: 'lalala'}})

    @router.add page

    request '/pages/this-is-a-slug'

    expect(last_response.status).to eq(200)
  end
 
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gurk-0.0.1 spec/gurk/router_spec.rb