spec/client/template_spec.rb in mirage-3.0.0.alpha.9 vs spec/client/template_spec.rb in mirage-3.0.0.alpha.10

- old
+ new

@@ -7,11 +7,11 @@ describe 'get' do it 'should load a template given its id' do endpoint = "endpoint" id = 1 requests_url = 'request_url' - value = "Hello" + body = "Hello" default = false delay = 1.2 content_type = "application/json" status = 201 headers = {'header' => 'value'} @@ -26,11 +26,11 @@ endpoint: endpoint, id: id, requests_url: requests_url, response:{ default: default, - body: value, + body: body, delay: delay, content_type: content_type, status: status, headers: headers }, @@ -44,11 +44,11 @@ template_url = "url" Template.should_receive(:backedup_get).with(template_url, :format => :json).and_return(template_json) template = Template.get(template_url) - template.value.should == value + template.body.should == body template.endpoint.should == endpoint template.id.should == id template.default.should == default template.default.should == default @@ -119,7 +119,21 @@ Mirage::Request.should_receive(:delete).with(request_url) template.delete end + end + + describe 'method missing' do + it 'should delagate to the caller if it is set' do + caller = Object.new + caller.should_receive(:some_method) + template = Template.new('endpoint') + template.caller_binding = caller + template.some_method + end + + it 'should throw a standard method missing error if a caller binding is not set' do + expect{Template.new('endpoint').some_method}.should raise_error(NameError) + end end end