Sha256: 8047907542741de5a7d680ff40b195d4324013244d32240508f1d20b90807cef

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

require 'acceptance_auth/spec_helper'

describe "authenticated database" do
  subject { ARANGO_HOST }

  it "should have booted up an ArangoDB instance" do
    expect { RestClient.get(subject) }.to raise_error RestClient::Unauthorized
  end

  context "authentication" do
    subject { Ashikawa::Core::Database.new ARANGO_HOST }

    context "without user and password" do
      it "should not allow access to DB" do
        expect do
          subject["new_collection"]
        end.to raise_error RestClient::Unauthorized
      end
    end

    context "with user and password" do
      it "should allow acces to DB" do
        subject.authenticate_with :username => 'testuser', :password => 'testpassword'

        expect do
          subject["new_collection"]
          subject["new_collection"].delete
        end.to_not raise_error
      end

      it "should deny acces if username and password are wrong" do
        subject.authenticate_with :username => 'ruffy', :password => 'three_headed_monkey'

        expect do
          subject["denied"]
        end.to raise_error RestClient::Unauthorized
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ashikawa-core-0.8.0 spec/acceptance_auth/auth_spec.rb
ashikawa-core-0.7.2 spec/acceptance_auth/auth_spec.rb
ashikawa-core-0.7.1 spec/acceptance_auth/auth_spec.rb
ashikawa-core-0.7.0 spec/acceptance_auth/auth_spec.rb
ashikawa-core-0.6.0 spec/acceptance_auth/auth_spec.rb