Sha256: 7985ebb3bb105daaf0a26c4bcf50cc9cb6843ef79975b912b08c3360f58c64d6

Contents?: true

Size: 1.31 KB

Versions: 10

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe Architect4r::Server do
  
  subject { TEST_SERVER }
  
  it "should create a node" do
    result = subject.create_node({ 'name' => 'My test node', 'friends' => 13 })
    result.should be_a(Hash)
    result['self'].should be_a(String)
  end
  
  it "should get a node" do
    result = subject.get_node(0)
    result.should be_a(Hash)
    result['self'].should be_a(String)
  end
  
  it "should delete a node" do
    # Create a node which can be deleted
    node = subject.create_node({ 'test' => 'test' })
    node.should be_a(Hash)
    
    # Delete the node
    subject.delete_node(node['self'])
    
    # Check if it still exists
    subject.get_node(node['self']).should be_nil
  end
  
  it "should update a nodes properties" do
    # Create a node which can be deleted
    original_node = subject.create_node({ 'test1' => 'test', 'test2' => 'hello' })
    original_node.should be_a(Hash)
    
    # Update some attributes
    result = subject.update_node(original_node['self'], { 'test1' => 'world', 'test3' => 'word'})
    result.should be_true
    
    # check result
    changed_node = subject.get_node(original_node['self'])
    changed_node['data']['test1'].should == 'world'
    changed_node['data'].has_key?('test2').should be_false
    changed_node['data']['test3'].should == 'word'
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
architect4r-0.4.3.1 spec/core/node_methods_spec.rb
architect4r-0.4.3 spec/core/node_methods_spec.rb
architect4r-0.4.2 spec/core/node_methods_spec.rb
architect4r-0.4.1 spec/core/node_methods_spec.rb
architect4r-0.4 spec/core/node_methods_spec.rb
architect4r-0.3.4.2 spec/core/node_methods_spec.rb
architect4r-0.3.4.1 spec/core/node_methods_spec.rb
architect4r-0.3.4 spec/core/node_methods_spec.rb
architect4r-0.3.3.1 spec/core/node_methods_spec.rb
architect4r-0.3.2 spec/core/node_methods_spec.rb