Sha256: ce3bf515c643755be31534aa78a40d8620cf874baf7ed0054de132c916d06e54

Contents?: true

Size: 667 Bytes

Versions: 10

Compression:

Stored size: 667 Bytes

Contents

require 'test_helper'
require 'rack/test'

class WebTest < Test::Unit::TestCase
  include Rack::Test::Methods

  def app
    Robut::Web
  end

  def setup
    app.set :show_exceptions, false
    app.set :raise_errors, true
    app.set :connection, connection
  end

  def test_root
    get '/'

    assert last_response.ok?
  end

  def test_say
    app.class_eval do
      get '/test_say' do
        say "Hello", nil
        halt 200
      end
    end

    get '/test_say'

    assert_equal messages.first, ["Hello", nil]
  end

private

  def messages
    connection.messages
  end

  def connection
    @connection ||= Robut::ConnectionMock.new.connect
  end

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
sclemmer-robut-0.6.3 test/unit/web_test.rb
sclemmer-robut-0.6.2 test/unit/web_test.rb
sclemmer-robut-0.6.1 test/unit/web_test.rb
sclemmer-robut-0.6.0 test/unit/web_test.rb
sclemmer-robut-0.5.4 test/unit/web_test.rb
sclemmer-robut-0.5.3 test/unit/web_test.rb
sclemmer-robut-0.5.2 test/unit/web_test.rb
robut-0.5.2 test/unit/web_test.rb
robut-0.5.1 test/unit/web_test.rb
robut-0.5.0 test/unit/web_test.rb