Sha256: e67cc4ebd3872369072f006e916f5aba8c511e5d6c0575608fde9e5c637e7764

Contents?: true

Size: 1.38 KB

Versions: 14

Compression:

Stored size: 1.38 KB

Contents

require 'test_helper'

class TestCaseTest < ActionController::TestCase
  include Roar::Rails::TestCase
  
  class BandController < ActionController::Base
    def show
      render :text => "#{request.body.string}#{params[:id]}"
    end
    
  end
  
  tests BandController
  
  test "allows POST without body" do
    post :show
    assert_equal "", response.body
  end
  
  test "allows POST with options, only" do
    post :show, :id => 1
    assert_equal "1", response.body
  end
  
  test "allows POST with document" do
    post :show, "{}"
    assert_equal "{}", response.body
  end
  
  test "allows POST with document and options" do
    post :show, "{}", :id => 1
    assert_equal "{}1", response.body
  end
  
  test "allows GET" do
    get :show, :id => 1
    assert_equal "1", response.body
  end
  
  test "allows PUT" do
    put :show, "{}", :id => 1
    assert_equal "{}1", response.body
  end
  
  test "allows DELETE" do
    delete :show, "{}", :id => 1
    assert_equal "{}1", response.body
  end
  
  test "#assert_body" do
    get :show, :id => 1
    assert_body "1"
    
    # TODO: check message.
    assert_raises MiniTest::Assertion do
      assert_body "3"
    end
  end
  
  test "#assert_body with xml" do
    @controller.instance_eval do
      def show
        render :text => "<order/>"
      end
    end
    
    get :show
    assert_body "<order></order>", :xml => true
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
roar-rails-0.0.15 test/test_case_test.rb
roar-rails-0.0.14 test/test_case_test.rb
roar-rails-0.0.13 test/test_case_test.rb
roar-rails-0.0.12 test/test_case_test.rb
roar-rails-0.0.11 test/test_case_test.rb
roar-rails-0.0.10 test/test_case_test.rb
roar-rails-0.0.9 test/test_case_test.rb
roar-rails-0.0.8 test/test_case_test.rb
roar-rails-0.0.7 test/test_case_test.rb
roar-rails-0.0.6 test/test_case_test.rb
roar-rails-0.0.5 test/test_case_test.rb
roar-rails-0.0.4 test/test_case_test.rb
roar-rails-0.0.3 test/test_case_test.rb
roar-rails-0.0.2 test/test_case_test.rb