Sha256: f8ec9fe09965e37ab9ba976ec9a8364f9ab09b5a0f1938c7e5c7fd3fb0dca92c
Contents?: true
Size: 1.85 KB
Versions: 2
Compression:
Stored size: 1.85 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe MarilynRPC::Service do before(:each) do class TestService < MarilynRPC::Service register "/test" end class ExtendedTestService < MarilynRPC::Service register "/test/extended" end end it "should have to registered services" do MarilynRPC::Service.__registry__.size.should >= 2 MarilynRPC::Service.__registry__["/test/extended"].should == ExtendedTestService MarilynRPC::Service.__registry__["/test"].should == TestService end context "callbacks" do before(:each) do class ExtendedTestService < MarilynRPC::Service attr_reader :value after_connect :connect after_disconnect :disconnect def connect @value = :connect end def disconnect @value = :disconnect end end @service = ExtendedTestService.new end it "should be possible to register a after_connect callback" do expect do @service.__run_callbacks__(:after_connect) end.to(change(@service, :value).from(nil).to(:connect)) end it "should be possible to register a after_disconnect callback" do expect do @service.__run_callbacks__(:after_disconnect) end.to(change(@service, :value).from(nil).to(:disconnect)) end end context "authentication" do before(:each) do class ExtendedTestService < MarilynRPC::Service authentication_required :secure def normal true end def secure false end end @service = ExtendedTestService.new end it "should be possible to find the secure method in the auth. hash" do @service.class.__methods_with_authentication__[:secure].should be_true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
marilyn-rpc-0.0.4 | spec/service_spec.rb |
marilyn-rpc-0.0.3 | spec/service_spec.rb |