From 69eefadae1c9db9d4614054b3dc4b67a3dd2079f Mon Sep 17 00:00:00 2001 From: Tyler Pickett Date: Wed, 3 Oct 2012 15:52:06 -0500 Subject: [PATCH] add spec for #generate_login_ticket Signed-off-by: Tyler Pickett Conflicts: spec/casserver/cas_spec.rb --- spec/casserver/cas_spec.rb | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 spec/casserver/cas_spec.rb diff --git a/spec/casserver/cas_spec.rb b/spec/casserver/cas_spec.rb new file mode 100644 index 0000000..b2ba766 --- /dev/null +++ b/spec/casserver/cas_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +module CASServer; end +require 'casserver/cas' + +describe CASServer::CAS do + before do + load_server + @klass = Class.new { + include CASServer::CAS + } + @client_hostname = 'myhost.test' + @host = @klass.new + @host.instance_variable_set(:@env, { + 'REMOTE_HOST' => @client_hostname + }) + end + + describe "#generate_login_ticket" do + before do + @lt = @host.generate_login_ticket + end + + it "should return a login ticket" do + @lt.class.should == CASServer::Model::LoginTicket + end + + it "should set the client_hostname" do + @lt.client_hostname.should == @client_hostname + end + + it "should set the ticket string" do + @lt.ticket.should_not be_nil + end + + it "SHOULD set the ticket string starting with 'LT'" do + @lt.ticket.should match /^LT/ + end + + it "should not mark the ticket as consumed" do + @lt.consumed.should be_nil + end + end +end