Skip to content

Commit

Permalink
fix: new logged_in_as spec helper & fix spec broken since require_per…
Browse files Browse the repository at this point in the history
…mission feture
  • Loading branch information
byroot committed Mar 4, 2011
1 parent e473519 commit fd33398
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions spec/controllers/admin/base_controller_spec.rb
Expand Up @@ -2,6 +2,10 @@

describe Admin::BaseController do

before :each do
logged_in_as Fabricate(:user, :state => 'activated', :is_admin => true)
end

describe '#index' do

it 'should be success' do
Expand Down
4 changes: 4 additions & 0 deletions spec/controllers/admin/groups_controller_spec.rb
Expand Up @@ -2,6 +2,10 @@

describe Admin::GroupsController do

before :each do
logged_in_as Fabricate(:user, :state => 'activated', :is_admin => true)
end

describe '#index' do

before :each do
Expand Down
4 changes: 4 additions & 0 deletions spec/controllers/admin/servers_controller_spec.rb
Expand Up @@ -2,6 +2,10 @@

describe Admin::ServersController do

before :each do
logged_in_as Fabricate(:user, :state => 'activated', :is_admin => true)
end

describe '#index' do

before :each do
Expand Down
4 changes: 3 additions & 1 deletion spec/controllers/messages_controller_spec.rb
Expand Up @@ -5,12 +5,13 @@
describe '#new' do

before :each do
logged_in_as Fabricate(:user, :state => 'activated')
@group = Fabricate(:group)
@topic = Fabricate(:topic)
end

it 'should be success' do
get :new, :group_id => 'comp.lang.ruby', :topic_id => @topic.index.to_s, :parent => '0-0'
get :new, :group_id => 'comp.lang.ruby', :topic_id => @topic.index.to_s, :parent => '1-0-0'
response.should be_success
end

Expand Down Expand Up @@ -39,6 +40,7 @@
describe '#create' do

before :each do
logged_in_as Fabricate(:user, :state => 'activated')
@group = Fabricate(:group)
@topic = Fabricate(:topic)
end
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/topics_controller_spec.rb
Expand Up @@ -97,6 +97,7 @@

before :each do
@group = Fabricate(:group)
logged_in_as Fabricate(:user, :state => 'activated')
end

it 'should be success' do
Expand All @@ -110,6 +111,7 @@

before :each do
@group = Fabricate(:group)
logged_in_as Fabricate(:user, :state => 'activated')
end

it 'should redirect to topic_path when successful' do
Expand Down
3 changes: 3 additions & 0 deletions spec/support/helpers/authentication_helper.rb
@@ -0,0 +1,3 @@
def logged_in_as(user)
controller.send(:current_user=, user)
end

0 comments on commit fd33398

Please sign in to comment.