Add specs for people#show when you're viewing your own page
This commit is contained in:
parent
11a4544882
commit
edf15aa5bd
1 changed files with 19 additions and 9 deletions
|
|
@ -16,11 +16,9 @@ describe PeopleController do
|
||||||
describe '#index (search)' do
|
describe '#index (search)' do
|
||||||
before do
|
before do
|
||||||
@eugene = Factory.create(:person,
|
@eugene = Factory.create(:person,
|
||||||
:profile => Factory.build(:profile, :first_name => "Eugene",
|
:profile => Factory.build(:profile, :first_name => "Eugene", :last_name => "w"))
|
||||||
:last_name => "w"))
|
|
||||||
@korth = Factory.create(:person,
|
@korth = Factory.create(:person,
|
||||||
:profile => Factory.build(:profile, :first_name => "Evan",
|
:profile => Factory.build(:profile, :first_name => "Evan", :last_name => "Korth"))
|
||||||
:last_name => "Korth"))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'responds with json' do
|
it 'responds with json' do
|
||||||
|
|
@ -104,14 +102,25 @@ describe PeopleController do
|
||||||
|
|
||||||
context "when the person is the current user" do
|
context "when the person is the current user" do
|
||||||
it "succeeds" do
|
it "succeeds" do
|
||||||
get :show, :id => @user.person.id
|
get :show, :id => @user.person.to_param
|
||||||
response.should be_success
|
response.should be_success
|
||||||
end
|
end
|
||||||
it "renders the user's posts" do
|
|
||||||
@user.post :status_message, :message => 'test more', :to => @aspect.id
|
it "assigns the right person" do
|
||||||
get :show, :id => @user.person.id
|
get :show, :id => @user.person.to_param
|
||||||
response.should be_success
|
assigns(:person).should == @user.person
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "assigns all the user's posts" do
|
||||||
|
@user.posts.should be_empty
|
||||||
|
@user.post(:status_message, :message => "to one aspect", :to => @aspect.id)
|
||||||
|
@user.post(:status_message, :message => "to all aspects", :to => 'all')
|
||||||
|
@user.post(:status_message, :message => "public", :to => 'all', :public => true)
|
||||||
|
@user.reload.posts.length.should == 3
|
||||||
|
get :show, :id => @user.person.to_param
|
||||||
|
assigns(:posts).should =~ @user.posts
|
||||||
|
end
|
||||||
|
|
||||||
it "renders the comments on the user's posts" do
|
it "renders the comments on the user's posts" do
|
||||||
message = @user.post :status_message, :message => 'test more', :to => @aspect.id
|
message = @user.post :status_message, :message => 'test more', :to => @aspect.id
|
||||||
@user.comment 'I mean it', :on => message
|
@user.comment 'I mean it', :on => message
|
||||||
|
|
@ -124,6 +133,7 @@ describe PeopleController do
|
||||||
before do
|
before do
|
||||||
@person = bob.person
|
@person = bob.person
|
||||||
end
|
end
|
||||||
|
|
||||||
it "succeeds" do
|
it "succeeds" do
|
||||||
get :show, :id => @person.id
|
get :show, :id => @person.id
|
||||||
response.should be_success
|
response.should be_success
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue