Sha256: 084220a5c67c395f2140375e1c179ceba41c2b424f313031f90d99b588d12442

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

class ResourceTestCase

  shared "return 400 because no params were given" do
    use "return 400 Bad Request"

    test "body should say no params were given" do
      assert_include "errors", parsed_response_body
      assert_include "no_params", parsed_response_body["errors"]
    end
  end

  shared "return 400 because invalid params were present" do
    use "return 400 Bad Request"

    test "body should say invalid params were present" do
      assert_include "errors", parsed_response_body
      assert_include "invalid_params", parsed_response_body["errors"]
    end
  end

  shared "return 401 because the API key is invalid" do
    use "return 401 Unauthorized"

    test "body should say the API key is invalid" do
      assert_include "errors", parsed_response_body
      assert_include "invalid_api_key", parsed_response_body["errors"]
    end
  end

  shared "return 401 because the API key is missing" do
    use "return 401 Unauthorized"

    test "body should say the API key is missing" do
      assert_include "errors", parsed_response_body
      assert_include "missing_api_key", parsed_response_body["errors"]
    end
  end

  shared "return 401 because the API key is unauthorized" do
    use "return 401 Unauthorized"

    test "body should say the API key is unauthorized" do
      assert_include "errors", parsed_response_body
      assert_include "unauthorized_api_key", parsed_response_body["errors"]
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sinatra_resource-0.4.24 examples/datacatalog/test/helpers/shared/api_keys.rb
sinatra_resource-0.4.23 examples/datacatalog/test/helpers/shared/api_keys.rb
sinatra_resource-0.4.22 examples/datacatalog/test/helpers/shared/api_keys.rb