Refactor PostsController spec code a little. (DRY up a bit)
This commit is contained in:
parent
fae9aee425
commit
511d51318d
1 changed files with 20 additions and 17 deletions
|
|
@ -55,20 +55,29 @@ describe PostsController do
|
|||
|
||||
context 'user not signed in' do
|
||||
|
||||
it 'shows a public post' do
|
||||
status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all')
|
||||
context 'given a public post' do
|
||||
before :each do
|
||||
@status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all')
|
||||
end
|
||||
|
||||
get :show, :id => status.id
|
||||
it 'shows a public post' do
|
||||
get :show, :id => @status.id
|
||||
response.status.should == 200
|
||||
end
|
||||
|
||||
it 'succeeds for statusnet' do
|
||||
status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all')
|
||||
@request.env["HTTP_ACCEPT"] = "application/html+xml,text/html"
|
||||
get :show, :id => status.id
|
||||
get :show, :id => @status.id
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it 'responds with diaspora xml if format is xml' do
|
||||
get :show, :id => @status.guid, :format => :xml
|
||||
response.body.should == @status.to_diaspora_xml
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it 'shows a public photo' do
|
||||
pending
|
||||
status = Factory(:status_message_with_photo, :public => true, :author => alice.person)
|
||||
|
|
@ -83,12 +92,6 @@ describe PostsController do
|
|||
response.status = 302
|
||||
end
|
||||
|
||||
it 'responds with diaspora xml if format is xml' do
|
||||
status = alice.post(:status_message, :text => "hello", :public => true, :to => 'all')
|
||||
get :show, :id => status.guid, :format => :xml
|
||||
response.body.should == status.to_diaspora_xml
|
||||
end
|
||||
|
||||
# We want to be using guids from now on for this post route, but do not want to break
|
||||
# pre-exisiting permalinks. We can assume a guid is 8 characters long as we have
|
||||
# guids set to hex(8) since we started using them.
|
||||
|
|
|
|||
Loading…
Reference in a new issue