Sha256: 68c75abebcc3e5d3277d34ab9771f7346e6ea8bb6c300957c2b93f1746a48dc6

Contents?: true

Size: 824 Bytes

Versions: 2

Compression:

Stored size: 824 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Ki::Req do
  before :each do
    class Book < Ki::Model
    end
    @db = Ki::Db.instance
    @db.remove_collections
  end

  it "should handle SEARCH verb" do
    post = Ki::ReqFactory.new(:post, { :title => 'Foundation' })
    hash = Book.new(post).hash

    search = Ki::ReqFactory.new(:search, { :title => 'Foundation' })
    hash = Book.new(search).hash
    hash[0]['title'].should == 'Foundation'
  end

  it "should format the id properly" do
    post = Ki::ReqFactory.new(:post, { :title => 'Foundation' })
    id = Book.new(post).hash['id']

    get = Ki::ReqFactory.new(:get, { :title => 'Foundation' })
    Book.new(get).hash[0]['id'].should == id

    update = Ki::ReqFactory.new(:put, { 'id' => id, :title => 'Foundation' })
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ki-0.3.3 spec/req_spec.rb
ki-0.3.2 spec/req_spec.rb