Sha256: 82581cf4da3a0f54b09d2e080510322c90c12a733d519c0e20459650b788f82b

Contents?: true

Size: 676 Bytes

Versions: 34

Compression:

Stored size: 676 Bytes

Contents

module RequestHelpers
    include Rack::Test::Methods

    def app
        Cuboid::Rest::Server
    end

    def response_data
        JSON.load response.body
    rescue => e
        ap response
        raise
    end

    def pretty_response_body
        JSON.pretty_generate( response_data )
    end

    def response_body
        response.body
    end

    def response_code
        response.status
    end

    def response
        last_response
    end

    %w(get post put delete).each do |m|
        define_method m do |path, parameters = nil, headers = {}|
            super( path, (parameters.to_json if parameters), headers )
        end
    end

    extend self
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
cuboid-0.2.13 spec/support/helpers/request_helpers.rb
cuboid-0.2.12 spec/support/helpers/request_helpers.rb
cuboid-0.2.11 spec/support/helpers/request_helpers.rb
cuboid-0.2.10 spec/support/helpers/request_helpers.rb
cuboid-0.2.9 spec/support/helpers/request_helpers.rb
cuboid-0.2.8 spec/support/helpers/request_helpers.rb
cuboid-0.2.7 spec/support/helpers/request_helpers.rb
cuboid-0.2.6 spec/support/helpers/request_helpers.rb
cuboid-0.2.5 spec/support/helpers/request_helpers.rb
cuboid-0.2.4.2 spec/support/helpers/request_helpers.rb
cuboid-0.2.4.1 spec/support/helpers/request_helpers.rb
cuboid-0.2.4 spec/support/helpers/request_helpers.rb
cuboid-0.2.3 spec/support/helpers/request_helpers.rb
cuboid-0.2.2 spec/support/helpers/request_helpers.rb
cuboid-0.2.1 spec/support/helpers/request_helpers.rb
cuboid-0.2 spec/support/helpers/request_helpers.rb
cuboid-0.1.9.1 spec/support/helpers/request_helpers.rb
cuboid-0.1.9 spec/support/helpers/request_helpers.rb
cuboid-0.1.8 spec/support/helpers/request_helpers.rb
cuboid-0.1.7 spec/support/helpers/request_helpers.rb