Sha256: af59fdc4c44d0c7434248f948fecd3930d702c23bd5826135337ddc23554dc7f

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

require_relative '../../lib/melodiest/auth'

describe Melodiest::Auth::Http do
  it "respond to authorized!" do
    expect(Melodiest::Auth::Http.method_defined?(:authorized!)).to be_truthy
  end

  it "respond to authorized?" do
    expect(Melodiest::Auth::Http.method_defined?(:authorized?)).to be_truthy
  end

  it "returns 401 status code without authentication" do
    get "/protected"
    expect(last_response.status).to eq 401
  end

  it "returns 401 status code with bad authentication" do
    get "/protected"
    expect(last_response.status).to eq 401
  end

  it "returns 200 status code with good authentication" do
    authorize "admin", "admin"
    get "/protected"
    expect(last_response.status).to eq 200
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
melodiest-0.1.1 spec/melodiest/auth_spec.rb
melodiest-0.1.0 spec/melodiest/auth_spec.rb