Sha256: 51b9163d93e08c4afc6b7bc5d190b1a41229ee430111c3a47305392dbfdf4969

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'spec_helper'
require 'riedi/server'

describe Riedi::Server do
  before do
    @storage = Riedi::Storage.new
    @storage.flushall
    @storage.set("key", "value")
  end

  def app
    Riedi::Server
  end

  it "GET /status" do
    get "/status" do
      last_response.status.should be(200)
      last_response.body.should eq("OK")
    end
  end

  it "GET /keys" do
    get "/keys" do
      last_response.status.should be(200)
      last_response.body.should eq("[\"key\"]")
    end
  end

  it "POST /store/key" do
    post "/store/key", "value=value" do
      last_response.status.should be(200)
      last_response.body.should eq("OK")
    end
  end

  it "GET /store/key" do
    get "/store/key" do
      last_response.status.should be(200)
      last_response.body.should eq("value")
    end
  end

  it "GET /store/missing" do
    get "/store/missing" do
      last_response.status.should be(404)
      last_response.body.should eq("")
    end
  end

  it "DELETE /store/key" do
    delete "/store/key" do
      last_response.status.should be(200)
      last_response.body.should eq("1")
    end
  end

  it "DELETE /store/missing" do
    delete "/store/missing" do
      last_response.status.should be(404)
      last_response.body.should eq("")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
riedi-0.0.1 spec/riedi/server_spec.rb