summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2012-09-25 19:22:44 -0400
committerRobert Speicher <rspeicher@gmail.com>2012-09-26 16:32:23 -0400
commit3ad931ca9211d2ca0f345f97db00193ee5533dfd (patch)
tree3a62c7232bbe9bebdfd7bd2784525566847863ba /spec/helpers
parent95f0a4114139d49b3979d6f0e53baa53193a624a (diff)
downloadgitlab-ce-3ad931ca9211d2ca0f345f97db00193ee5533dfd.tar.gz
Add current_controller? helper method
Simplifies some of the "active tab" checks we're doing
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/application_helper_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 9a2df31479c..10250c93883 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -1,6 +1,20 @@
require 'spec_helper'
describe ApplicationHelper do
+ describe 'current_controller?' do
+ before do
+ controller.stub!(:controller_name).and_return('foo')
+ end
+
+ it "returns true when controller matches argument" do
+ current_controller?(:foo).should be_true
+ end
+
+ it "returns false when controller does not match argument" do
+ current_controller?(:bar).should_not be_true
+ end
+ end
+
describe "gravatar_icon" do
let(:user_email) { 'user@email.com' }