Sha256: 8b3dfced8736e8bec3d7314b62e734e9653f0b4bd3bca025b8463e177c1a8493

Contents?: true

Size: 956 Bytes

Versions: 11

Compression:

Stored size: 956 Bytes

Contents

module Roar
  module Rails
    module TestCase
      def get(action, *args)
        process(action, "GET", *args)
      end

      def post(action, *args)
        process(action, "POST", *args)
      end

      def put(action, *args)
        process(action, "PUT", *args)
      end

      def delete(action, *args)
        process(action, "DELETE", *args)
      end

      def process(action, http_method, document="", params={})
        if document.is_a?(Hash)
          params = document
          document = ""
        end

        request.env['RAW_POST_DATA'] = document

        super(action, params, nil, nil, http_method)  # FIXME: for Rails <=3.1, only.
      end

      module Assertions
        require 'test_xml/test_unit'
        def assert_body(body, options={})
          return assert_xml_equal body, response.body if options[:xml]
          assert_equal body, response.body
        end
      end

      include Assertions
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
roar-rails-0.0.13 lib/roar/rails/test_case.rb
roar-rails-0.0.12 lib/roar/rails/test_case.rb
roar-rails-0.0.11 lib/roar/rails/test_case.rb
roar-rails-0.0.10 lib/roar/rails/test_case.rb
roar-rails-0.0.9 lib/roar/rails/test_case.rb
roar-rails-0.0.8 lib/roar/rails/test_case.rb
roar-rails-0.0.7 lib/roar/rails/test_case.rb
roar-rails-0.0.6 lib/roar/rails/test_case.rb
roar-rails-0.0.5 lib/roar/rails/test_case.rb
roar-rails-0.0.4 lib/roar/rails/test_case.rb
roar-rails-0.0.3 lib/roar/rails/test_case.rb