Explorar el Código

remove unused method

Andrew Cantino hace 10 años
padre
commit
e26a6dcfbf

+ 2 - 2
app/controllers/application_controller.rb

@@ -15,7 +15,7 @@ class ApplicationController < ActionController::Base
   end
 
   def authenticate_admin!
-    redirect_to(root_path, alert: 'Admin access required to view that page.') unless current_user && current_user.admin
+    redirect_to(root_path, alert: 'Admin access required to view that page.') unless current_user && current_user.admin?
   end
 
   def upgrade_warning
@@ -25,6 +25,7 @@ class ApplicationController < ActionController::Base
   end
 
   private
+
   def twitter_oauth_check
     if ENV['TWITTER_OAUTH_KEY'].blank? || ENV['TWITTER_OAUTH_SECRET'].blank?
       if @twitter_agent = current_user.agents.where("type like 'Agents::Twitter%'").first
@@ -39,5 +40,4 @@ class ApplicationController < ActionController::Base
       @basecamp_agent = current_user.agents.where(type: 'Agents::BasecampAgent').first
     end
   end
-
 end

+ 0 - 4
app/helpers/application_helper.rb

@@ -38,8 +38,4 @@ module ApplicationHelper
       link_to 'No', agent_path(agent, tab: (agent.recent_error_logs? ? 'logs' : 'details')), class: 'label label-danger'
     end
   end
-
-  def user_is_admin?
-    current_user && current_user.admin == true
-  end
 end

+ 4 - 1
spec/controllers/jobs_controller_spec.rb

@@ -10,10 +10,13 @@ describe JobsController do
     end
 
     it "does not allow normal users" do
+      users(:bob).should_not be_admin
       sign_in users(:bob)
       get(:index).should redirect_to(root_path)
     end
-    it "returns all jobs", focus: true do
+
+    it "returns all jobs" do
+      users(:jane).should be_admin
       sign_in users(:jane)
       get :index
       assigns(:jobs).length.should == 2