added pretty (but dumb) update of sockets, and fixed some tests which broke as a result. needs better tests and the code is U G L Y
This commit is contained in:
parent
789bf877f2
commit
989949a8c9
6 changed files with 12 additions and 6 deletions
|
|
@ -4,7 +4,10 @@
|
||||||
%b shared a link
|
%b shared a link
|
||||||
%br
|
%br
|
||||||
= post.title
|
= post.title
|
||||||
= link_to post.link.to_s, post.link
|
/- (foo = post.link.to_s)
|
||||||
|
/- (bar = post.link)
|
||||||
|
%a{:href => "#{post.link}"}
|
||||||
|
= post.link
|
||||||
%div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", bookmark_path(post)
|
%div.time= link_to "#{time_ago_in_words(post.updated_at)} ago", bookmark_path(post)
|
||||||
- if mine?(post)
|
- if mine?(post)
|
||||||
= link_to 'Destroy', bookmark_path(post), :confirm => 'Are you sure?', :method => :delete
|
= link_to 'Destroy', bookmark_path(post), :confirm => 'Are you sure?', :method => :delete
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
%div.time
|
%div.time
|
||||||
= "#{time_ago_in_words(post.updated_at)} ago"
|
= "#{time_ago_in_words(post.updated_at)} ago"
|
||||||
- if mine?(post)
|
- if mine?(post)
|
||||||
/= link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete
|
= link_to 'Destroy', status_message_path(post), :confirm => 'Are you sure?', :method => :delete
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
||||||
describe BookmarksController do
|
describe BookmarksController do
|
||||||
before do
|
before do
|
||||||
#TODO(dan) Mocking Warden; this is a temp fix
|
#TODO(dan) Mocking Warden; this is a temp fix
|
||||||
|
|
||||||
request.env['warden'] = mock_model(Warden, :authenticate? => @user, :authenticate! => @user)
|
request.env['warden'] = mock_model(Warden, :authenticate? => @user, :authenticate! => @user)
|
||||||
@bob = Factory.build(:user)
|
@bob = Factory.build(:user)
|
||||||
@bookmark = Factory.build(:bookmark)
|
@bookmark = Factory.build(:bookmark)
|
||||||
|
|
@ -31,7 +32,7 @@ describe BookmarksController do
|
||||||
it "update action should redirect when model is valid" do
|
it "update action should redirect when model is valid" do
|
||||||
#TODO(dan) look into why we need to create a new bookmark object here
|
#TODO(dan) look into why we need to create a new bookmark object here
|
||||||
Bookmark.any_instance.stubs(:valid?).returns(true)
|
Bookmark.any_instance.stubs(:valid?).returns(true)
|
||||||
n = Factory.create(:bookmark, :link => "http://hotub.com")
|
n = Factory.create(:bookmark, :link => "http://hotub.com/")
|
||||||
n.save
|
n.save
|
||||||
put :update, :id => Bookmark.first.id
|
put :update, :id => Bookmark.first.id
|
||||||
response.should redirect_to(bookmark_url(assigns[:bookmark]))
|
response.should redirect_to(bookmark_url(assigns[:bookmark]))
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ describe Diaspora do
|
||||||
|
|
||||||
describe "body" do
|
describe "body" do
|
||||||
before do
|
before do
|
||||||
@post = Factory.create(:post)
|
@post = Factory.create(:status_message)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should add the following methods to Post on inclusion" do
|
it "should add the following methods to Post on inclusion" do
|
||||||
|
|
@ -71,7 +71,7 @@ describe Diaspora do
|
||||||
it "should check that it does not send a friends post to an owners friends" do
|
it "should check that it does not send a friends post to an owners friends" do
|
||||||
Post.stub(:build_xml_for).and_return(true)
|
Post.stub(:build_xml_for).and_return(true)
|
||||||
Post.should_not_receive(:build_xml_for)
|
Post.should_not_receive(:build_xml_for)
|
||||||
Factory.create(:post, :owner => "nottheowner@post.com")
|
Factory.create(:status_message, :owner => "nottheowner@post.com")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should ensure one url is created for every friend" do
|
it "should ensure one url is created for every friend" do
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,9 @@ describe Post do
|
||||||
|
|
||||||
describe 'defaults' do
|
describe 'defaults' do
|
||||||
before do
|
before do
|
||||||
|
WebSocket.stub!(:update_clients)
|
||||||
@post = Factory.create(:post, :owner => nil, :source => nil, :snippet => nil)
|
@post = Factory.create(:post, :owner => nil, :source => nil, :snippet => nil)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should add an owner if none is present" do
|
it "should add an owner if none is present" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue