Move created_at back a second in .post

This commit is contained in:
Raphael Sofaer 2011-04-28 12:05:59 -07:00
parent 38e44b13aa
commit 899963d487
2 changed files with 7 additions and 7 deletions

View file

@ -44,19 +44,19 @@ describe TagsController do
sign_in :user, alice sign_in :user, alice
end end
it 'displays your own post' do it 'displays your own post' do
my_post = alice.post(:status_message, :text => "#what", :to => 'all', :created_at => Time.now - 1) my_post = alice.post(:status_message, :text => "#what", :to => 'all')
get :show, :name => 'what' get :show, :name => 'what'
assigns(:posts).models.should == [my_post] assigns(:posts).models.should == [my_post]
response.status.should == 200 response.status.should == 200
end end
it "displays a friend's post" do it "displays a friend's post" do
other_post = bob.post(:status_message, :text => "#hello", :to => 'all', :created_at => Time.now - 1) other_post = bob.post(:status_message, :text => "#hello", :to => 'all')
get :show, :name => 'hello' get :show, :name => 'hello'
assigns(:posts).models.should == [other_post] assigns(:posts).models.should == [other_post]
response.status.should == 200 response.status.should == 200
end end
it 'displays a public post' do it 'displays a public post' do
other_post = eve.post(:status_message, :text => "#hello", :public => true, :to => 'all', :created_at => Time.now - 1) other_post = eve.post(:status_message, :text => "#hello", :public => true, :to => 'all')
get :show, :name => 'hello' get :show, :name => 'hello'
assigns(:posts).models.should == [other_post] assigns(:posts).models.should == [other_post]
response.status.should == 200 response.status.should == 200
@ -80,8 +80,8 @@ describe TagsController do
end end
context "when there are posts to display" do context "when there are posts to display" do
before do before do
@post = alice.post(:status_message, :text => "#what", :public => true, :to => 'all', :created_at => Time.now - 1) @post = alice.post(:status_message, :text => "#what", :public => true, :to => 'all')
alice.post(:status_message, :text => "#hello", :public => true, :to => 'all', :created_at => Time.now - 1) alice.post(:status_message, :text => "#hello", :public => true, :to => 'all')
end end
it "succeeds" do it "succeeds" do
get :show, :name => 'what' get :show, :name => 'what'

View file

@ -23,8 +23,8 @@ class User
add_to_streams(p, aspects) add_to_streams(p, aspects)
dispatch_post(p, :to => opts[:to]) dispatch_post(p, :to => opts[:to])
end end
if opts[:created_at] unless opts[:created_at]
p.created_at = opts[:created_at] p.created_at = Time.now - 1
p.save p.save
end end
p p