Sha256: 72bc8a262ed926e7d90a7c7294275a79e9f6aa5493360413c3fe58449306331c

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

require 'helper'

class TestApplication < Test::Unit::TestCase
  context 'an Application instance' do
    subject { app.new }

    context '#call method' do
      subject { app.new.method :call }

      should 'exist' do
        assert subject
      end

      should 'have an arity of 1' do
        assert_equal 1, subject.arity
      end
    end
  end

  context 'get to /' do
    setup do
      get '/'
    end

    should 'be ok' do
      assert last_response.ok?
    end

    should 'list some known modules' do
      expected_constants = %w{ Cans Beverage TestApplication }

      expected_constants.each do |c|
        assert_match c, last_response.body
      end
    end
  end

  context 'get to /method/Beverage/.i/refreshing' do
    setup do
      get '/method/Beverage/.i/refreshing'
    end

    should 'be ok' do
      assert last_response.ok?
    end

    should 'include the source' do
      assert_match /quite/, last_response.body
    end
  end

  context 'get to /module/Beverage' do
    setup do
      get '/module/Beverage'
    end

    should 'be ok' do
      assert last_response.ok?
    end

    should 'include the "refreshing" instance method' do
      assert_match /refreshing/, last_response.body
    end
  end

  def app
    Cans::Application
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cans-0.2.3 test/test_application.rb
cans-0.2.2 test/test_application.rb
cans-0.2.1 test/test_application.rb
cans-0.2.0 test/test_application.rb
cans-0.1.2 test/test_application.rb
cans-0.1.1 test/test_application.rb
cans-0.1.0 test/test_application.rb