Sha256: 04db6f4d6ed0126db2795258e26e0e0779cc07159a51c442ba768efc992f1dc2

Contents?: true

Size: 867 Bytes

Versions: 13

Compression:

Stored size: 867 Bytes

Contents

require 'spec_helper'

class MagicResource 
	extend NSConnector::Attaching 
	def initialize upstream_store
	end
	def self.type_id
		'magic'
	end
end

class MagicTarget 
	extend NSConnector::Attaching
	def initialize upstream_store
	end
	def self.type_id
		'target'
	end
end

describe NSConnector::Attaching do
	it 'attach! works' do
		NSConnector::Restlet.should_receive(:execute!).with({
			:action => 'attach',
			:type_id => 'magic',
			:target_type_id => 'target',
			:attachee_id => 42,
			:data => [1,2,3],
			:attributes => nil,
		})

		MagicResource.attach!(MagicTarget, 42, [1,2,3])
	end


	it 'detach! works' do
		NSConnector::Restlet.should_receive(:execute!).with({
			:action => 'detach',
			:type_id => 'magic',
			:target_type_id => 'target',
			:attachee_id => 42,
			:data => [1,2,3]
		})

		MagicResource.detach!(MagicTarget, 42, [1,2,3])
	end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ns_connector-0.1.0 spec/attaching_spec.rb
ns_connector-0.0.17 spec/attaching_spec.rb
ns_connector-0.0.16 spec/attaching_spec.rb
ns_connector-0.0.15 spec/attaching_spec.rb
ns_connector-0.0.14 spec/attaching_spec.rb
ns_connector-0.0.13 spec/attaching_spec.rb
ns_connector-0.0.12 spec/attaching_spec.rb
ns_connector-0.0.11 spec/attaching_spec.rb
ns_connector-0.0.10 spec/attaching_spec.rb
ns_connector-0.0.9 spec/attaching_spec.rb
ns_connector-0.0.8 spec/attaching_spec.rb
ns_connector-0.0.7 spec/attaching_spec.rb
ns_connector-0.0.6 spec/attaching_spec.rb