Permalink
Browse files

Added User index spec

  • Loading branch information...
1 parent bd8fee2 commit 1f7329702e13f6d696ccc533d09cb391a58767db @hcarreras hcarreras committed Feb 13, 2014
Showing with 23 additions and 0 deletions.
  1. +23 −0 spec/controllers/user_controller_spec.rb
View
23 spec/controllers/user_controller_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe UsersController do
+ let(:bob){Fabricate(:user)}
+ let(:mozart){Fabricate(:user)}
+
+ describe('#index') do
+ context "When user is no moderator" do
+ it "try to get index" do
+ get :index
+ response.should redirect_to(root_path)
+ end
+ end
+
+ context "When user is moderator" do
+ before { sign_in Fabricate(:user, moderator: true) }
+ it "gets index with authorization" do
+ get :index
+ response.should be_success
+ end
+ end
+ end
+end

0 comments on commit 1f73297

Please sign in to comment.