spec/http_spec.rb in r509-ca-http-0.2 vs spec/http_spec.rb in r509-ca-http-0.2.1

- old
+ new

@@ -192,38 +192,47 @@ post "/1/certificate/revoke", "ca" => "test_ca" last_response.should_not be_ok last_response.body.should == "#<ArgumentError: Serial must be provided>" end it "when serial is given but not reason" do - @crls["test_ca"].should_receive(:revoke_cert).with(12345, 0).and_return(nil) + @crls["test_ca"].should_receive(:revoke_cert).with("12345", nil).and_return(nil) crl_list = double("crl-list") @crls["test_ca"].should_receive(:crl).and_return(crl_list) crl_list.should_receive(:to_pem).and_return("generated crl") post "/1/certificate/revoke", "ca" => "test_ca", "serial" => "12345" last_response.should be_ok last_response.body.should == "generated crl" end it "when serial and reason are given" do - @crls["test_ca"].should_receive(:revoke_cert).with(12345, 1).and_return(nil) + @crls["test_ca"].should_receive(:revoke_cert).with("12345", "1").and_return(nil) crl_list = double("crl-list") @crls["test_ca"].should_receive(:crl).and_return(crl_list) crl_list.should_receive(:to_pem).and_return("generated crl") post "/1/certificate/revoke", "ca" => "test_ca", "serial" => "12345", "reason" => "1" last_response.should be_ok last_response.body.should == "generated crl" end it "when serial is not an integer" do - @crls["test_ca"].should_receive(:revoke_cert).with(0, 0).and_raise(R509::R509Error.new("some r509 error")) + @crls["test_ca"].should_receive(:revoke_cert).with("foo", nil).and_raise(R509::R509Error.new("some r509 error")) post "/1/certificate/revoke", "ca" => "test_ca", "serial" => "foo" last_response.should_not be_ok last_response.body.should == "#<R509::R509Error: some r509 error>" end it "when reason is not an integer" do - @crls["test_ca"].should_receive(:revoke_cert).with(12345, 0).and_return(nil) + @crls["test_ca"].should_receive(:revoke_cert).with("12345", "foo").and_return(nil) crl_list = double("crl-list") @crls["test_ca"].should_receive(:crl).and_return(crl_list) crl_list.should_receive(:to_pem).and_return("generated crl") post "/1/certificate/revoke", "ca" => "test_ca", "serial" => "12345", "reason" => "foo" + last_response.should be_ok + last_response.body.should == "generated crl" + end + it "when reason is an empty string" do + @crls["test_ca"].should_receive(:revoke_cert).with("12345", nil).and_return(nil) + crl_list = double("crl-list") + @crls["test_ca"].should_receive(:crl).and_return(crl_list) + crl_list.should_receive(:to_pem).and_return("generated crl") + post "/1/certificate/revoke", "ca" => "test_ca", "serial" => "12345", "reason" => "" last_response.should be_ok last_response.body.should == "generated crl" end end