Sha256: 19c677888efa9166057034080485b2cbc792d6e32bb6d2192e03a049e500028c

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

class ResourceTestCase

  shared "return 400 because no parameters were given" do
    use "return 400 Bad Request"
    
    test "body should say no parameters were given" do
      assert_include "errors", parsed_response_body
      assert_include "no_params", parsed_response_body["errors"]
    end
  end

  shared "return 400 because parameters were not empty" do
    use "return 400 Bad Request"
    
    test "body should say parameters were non-empty" do
      assert_include "errors", parsed_response_body
      assert_include "non_empty_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

1 entries across 1 versions & 1 rubygems

Version Path
sinatra_resource-0.1.0 examples/datacatalog/test/helpers/shared/api_keys.rb