Sha256: 12ac6c560563391335bb871652974943123068696873ab8213c8c0da36ced476

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

require File.expand_path('../test_helper', __FILE__)

class ConnectionTest < MiniTest::Unit::TestCase
  def setup
    super
    @attributes = { "name" => "Arawn", "email" => email, "password" => password }
  end

  def test_get
    @publisher_connection.get("users")
  end

  def test_get_with_invalid_key
    connection = Fauna::Connection.new(:publisher_key => 'bad_key')
    assert_raises(Fauna::Connection::Unauthorized) do
      connection.get("users")
    end
  end

  def test_post
    @client_connection.post("users", @attributes)['resource']
  end

  def test_put
    user = @publisher_connection.post("users", @attributes)['resource']
    user = @publisher_connection.put(user['ref'], {:data => {:pockets => 2}})['resource']
    assert_equal 2, user['data']['pockets']
  end

  def test_delete
    user = @publisher_connection.post("users", @attributes)['resource']
    @publisher_connection.delete(user['ref'])
    assert_raises(Fauna::Connection::NotFound) do
      @publisher_connection.get(user['ref'])
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fauna-0.2.6 test/connection_test.rb
fauna-0.2.5 test/connection_test.rb
fauna-0.2.4 test/connection_test.rb
fauna-0.2.3 test/connection_test.rb
fauna-0.2.2 test/connection_test.rb
fauna-0.1.2 test/connection_test.rb
fauna-0.1.1 test/connection_test.rb
fauna-0.1 test/connection_test.rb