summaryrefslogtreecommitdiff
path: root/certs
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2012-11-20 11:58:09 -0800
committerjessib <jessib@leap.se>2012-11-20 11:58:09 -0800
commit80cd2489d87a523663d92776de55fa7fda2ecb99 (patch)
tree44e27ecffb66bc590de67a187954ba8ac96a9ede /certs
parent9289ae6601cacb746f83f9bd9d953d0591eac0da (diff)
parentcd743d686ade50a9b23965a99c57b8105e834ec9 (diff)
Merge branch 'develop' into help_develop
Diffstat (limited to 'certs')
-rw-r--r--certs/app/controllers/certs_controller.rb2
-rw-r--r--certs/test/functional/certs_controller_test.rb7
-rw-r--r--certs/test/test_helper.rb2
3 files changed, 10 insertions, 1 deletions
diff --git a/certs/app/controllers/certs_controller.rb b/certs/app/controllers/certs_controller.rb
index 6988a38..402bef3 100644
--- a/certs/app/controllers/certs_controller.rb
+++ b/certs/app/controllers/certs_controller.rb
@@ -1,5 +1,7 @@
class CertsController < ApplicationController
+ before_filter :authorize
+
# GET /cert
def show
@cert = Cert.pick_from_pool
diff --git a/certs/test/functional/certs_controller_test.rb b/certs/test/functional/certs_controller_test.rb
index 295515b..9bba8c0 100644
--- a/certs/test/functional/certs_controller_test.rb
+++ b/certs/test/functional/certs_controller_test.rb
@@ -4,7 +4,14 @@ class CertsControllerTest < ActionController::TestCase
setup do
end
+ test "should require login" do
+ get :show
+ assert_response :redirect
+ assert_redirected_to login_url
+ end
+
test "should send cert" do
+ login
cert = stub :zipped => "adsf", :zipname => "cert_stub.zip"
Cert.expects(:pick_from_pool).returns(cert)
get :show
diff --git a/certs/test/test_helper.rb b/certs/test/test_helper.rb
index 08d4d41..f6b4eb8 100644
--- a/certs/test/test_helper.rb
+++ b/certs/test/test_helper.rb
@@ -1,7 +1,7 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../../test/dummy/config/environment', __FILE__)
require 'rails/test_help'
-require 'mocha'
+require 'mocha/setup'
Rails.backtrace_cleaner.remove_silencers!