Sha256: 08c5aeaeed2d43522eba80e225392fc8b90314175ac83c9a219396d8d96e20ed
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
require 'unit/spec_helper' require 'ashikawa-core/edge' describe Ashikawa::Core::Edge do let(:database) { double } let(:raw_data) { { "_id" => "1234567/2345678", "_key" => "2345678", "_rev" => "3456789", "_from" => "7848004/9289796", "_to" => "7848004/9355332", "first_name" => "The", "last_name" => "Dude" } } subject { Ashikawa::Core::Edge } it "should initialize data" do document = subject.new(database, raw_data) document.id.should == "1234567/2345678" document.key.should == "2345678" document.revision.should == "3456789" end describe "initialized edge" do subject { Ashikawa::Core::Edge.new(database, raw_data)} it "should be deletable" do database.should_receive(:send_request).with("edge/#{raw_data['_id']}", { :delete => {} } ) subject.delete end it "should store changes to the database" do database.should_receive(:send_request).with("edge/#{raw_data['_id']}", { :put => { "first_name" => "The", "last_name" => "Other" } } ) subject["last_name"] = "Other" subject.save end it "should know the ID of the 'from' document" do subject.from_id.should == "7848004/9289796" end it "should know the ID of the 'to' document" do subject.to_id.should == "7848004/9355332" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ashikawa-core-0.8.0 | spec/unit/edge_spec.rb |