summaryrefslogtreecommitdiff
path: root/certs
diff options
context:
space:
mode:
Diffstat (limited to 'certs')
-rw-r--r--certs/app/controllers/certs_controller.rb4
-rw-r--r--certs/test/functional/certs_controller_test.rb10
2 files changed, 7 insertions, 7 deletions
diff --git a/certs/app/controllers/certs_controller.rb b/certs/app/controllers/certs_controller.rb
index 6db270c..6099ac0 100644
--- a/certs/app/controllers/certs_controller.rb
+++ b/certs/app/controllers/certs_controller.rb
@@ -1,10 +1,8 @@
class CertsController < ApplicationController
- before_filter :authorize
-
# GET /cert
def show
- @cert = ClientCertificate.new
+ @cert = ClientCertificate.new(free: !logged_in?)
render :text => @cert.key + @cert.cert, :content_type => 'text/plain'
end
diff --git a/certs/test/functional/certs_controller_test.rb b/certs/test/functional/certs_controller_test.rb
index 75256ca..6ebd08e 100644
--- a/certs/test/functional/certs_controller_test.rb
+++ b/certs/test/functional/certs_controller_test.rb
@@ -4,16 +4,18 @@ class CertsControllerTest < ActionController::TestCase
setup do
end
- test "should require login" do
+ test "should send free cert without login" do
+ cert = stub :cert => "free cert", :key => "key"
+ ClientCertificate.expects(:new).with(free: true).returns(cert)
get :show
- assert_response :redirect
- assert_redirected_to login_url
+ assert_response :success
+ assert_equal cert.key + cert.cert, @response.body
end
test "should send cert" do
login
cert = stub :cert => "adsf", :key => "key"
- ClientCertificate.expects(:new).returns(cert)
+ ClientCertificate.expects(:new).with(free: false).returns(cert)
get :show
assert_response :success
assert_equal cert.key + cert.cert, @response.body