spec/castronaut/presenters/proxy_validate_spec.rb in relevance-castronaut-0.6.1 vs spec/castronaut/presenters/proxy_validate_spec.rb in relevance-castronaut-0.7.4
- old
+ new
@@ -38,11 +38,11 @@
describe "represent!" do
it "validates the proxy ticket" do
@controller.params['service'] = 'http://example.com'
@controller.params['ticket'] = 'footicket'
- Castronaut::Models::ProxyTicket.should_receive(:validate_ticket).with('http://example.com', 'footicket').and_return(stub_everything(:valid? => false))
+ Castronaut::Models::ProxyTicket.should_receive(:validate_ticket).with('http://example.com', 'footicket').and_return(stub(:valid? => false).as_null_object)
Castronaut::Presenters::ProxyValidate.new(@controller).represent!
end
describe "when the parameters are valid" do
@@ -50,11 +50,11 @@
@controller.params['service'] = 'http://example.com'
@controller.params['ticket'] = 'footicket'
end
it "exposes the proxy ticket result as :proxy_ticket_result" do
- proxy_ticket_result = stub_everything(:valid? => false, :ticket_granting_ticket => stub_everything)
+ proxy_ticket_result = stub(:valid? => false, :ticket_granting_ticket => stub({}).as_null_object).as_null_object
Castronaut::Models::ProxyTicket.should_receive(:validate_ticket).and_return(proxy_ticket_result)
Castronaut::Presenters::ProxyValidate.new(@controller).represent!.proxy_ticket_result.should == proxy_ticket_result
end
it "exposes the service ticket username as :username" do
@@ -63,31 +63,31 @@
end
describe "when the proxy ticket result is a proxy ticket" do
it "creates an array of proxies from the proxy ticket results service ticket service" do
- service_ticket = stub_everything(:service => 'http://myservice.com')
- Castronaut::Models::ProxyTicket.should_receive(:validate_ticket).and_return(stub_everything(:valid? => true, :service_ticket => service_ticket))
+ service_ticket = stub(:service => 'http://myservice.com').as_null_object
+ Castronaut::Models::ProxyTicket.should_receive(:validate_ticket).and_return(stub(:valid? => true, :service_ticket => service_ticket).as_null_object)
Castronaut::Presenters::ProxyValidate.new(@controller).represent!
end
end
describe "when a proxy granting ticket url is present" do
it "attempts to generate a proxy granting ticket" do
@controller.params['pgtUrl'] = 'http://proxygrantingticketurl'
- Castronaut::Models::ProxyTicket.stub!(:validate_ticket).and_return(stub_everything(:valid? => true, :ticket => 'service ticket', :ticket_granting_ticket => stub_everything))
+ Castronaut::Models::ProxyTicket.stub!(:validate_ticket).and_return(stub(:valid? => true, :ticket => 'service ticket', :ticket_granting_ticket => stub({}).as_null_object).as_null_object)
- Castronaut::Models::ProxyGrantingTicket.should_receive(:generate_ticket).with('http://proxygrantingticketurl', '10.1.1.1', anything).and_return(stub_everything)
+ Castronaut::Models::ProxyGrantingTicket.should_receive(:generate_ticket).with('http://proxygrantingticketurl', '10.1.1.1', anything).and_return(stub({}).as_null_object)
Castronaut::Presenters::ProxyValidate.new(@controller).represent!
end
describe "when proxy granting ticket generation succeeds" do
it "gets :proxy_granting_ticket_iou from the proxy_granting_ticket_result" do
@controller.params['pgtUrl'] = 'http://proxygrantingticketurl'
- Castronaut::Models::ProxyTicket.stub!(:validate_ticket).and_return(stub('ticket result', :proxies => nil, :valid? => true, :ticket => 'service ticket', :ticket_granting_ticket => stub_everything))
+ Castronaut::Models::ProxyTicket.stub!(:validate_ticket).and_return(stub('ticket result', :proxies => nil, :valid? => true, :ticket => 'service ticket', :ticket_granting_ticket => stub({}).as_null_object))
Castronaut::Models::ProxyGrantingTicket.stub!(:generate_ticket).and_return(stub('proxy granting ticket result', :iou => 'pgtiou'))
Castronaut::Presenters::ProxyValidate.new(@controller).represent!.proxy_granting_ticket_iou.should == 'pgtiou'
end