Specs passing with text
This commit is contained in:
parent
4b4654a408
commit
1b0445563e
25 changed files with 35 additions and 35 deletions
|
|
@ -5,7 +5,7 @@
|
|||
module StatusMessagesHelper
|
||||
def my_latest_message
|
||||
unless @latest_status_message.nil?
|
||||
return @latest_status_message.message
|
||||
return @latest_status_message.text
|
||||
else
|
||||
return I18n.t('status_messages.helper.no_message_to_display')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class Service < ActiveRecord::Base
|
|||
def public_message(post, length, url = "")
|
||||
url = "" if post.respond_to?(:photos) && post.photos.count == 0
|
||||
space_for_url = url.blank? ? 0 : (url.length + 1)
|
||||
truncated = truncate(post.message(:plain_text => true), :length => (length - space_for_url))
|
||||
truncated = truncate(post.text(:plain_text => true), :length => (length - space_for_url))
|
||||
truncated = "#{truncated} #{url}" unless url.blank?
|
||||
return truncated
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class StatusMessage < Post
|
|||
|
||||
acts_as_taggable_on :tags
|
||||
|
||||
validates_length_of :message, :maximum => 1000, :text => "please make your status messages less than 1000 characters"
|
||||
validates_length_of :text, :maximum => 1000, :text => "please make your status messages less than 1000 characters"
|
||||
xml_name :status_message
|
||||
xml_attr :raw_message
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ class StatusMessage < Post
|
|||
|
||||
before_create :build_tags
|
||||
|
||||
def message(opts = {})
|
||||
def text(opts = {})
|
||||
self.formatted_message(opts)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
.span-8.last
|
||||
%p
|
||||
= markdownify(@photo.status_message.message)
|
||||
= markdownify(@photo.status_message.text)
|
||||
%span{:style=>'font-size:smaller'}
|
||||
=link_to t('.collection_permalink'), @photo.status_message
|
||||
%br
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
= link_to t('photos.show.view'), post_path(@post.status_message)
|
||||
|
||||
%p
|
||||
= @post.status_message.message
|
||||
= @post.status_message.text
|
||||
|
||||
%p
|
||||
- for photo in @post.status_message.photos
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
.span-14.append-1.last
|
||||
#show_text
|
||||
%p
|
||||
= markdownify(@post.message, :youtube_maps => @post[:youtube_titles])
|
||||
= markdownify(@post.text, :youtube_maps => @post[:youtube_titles])
|
||||
|
||||
- for photo in @post.photos
|
||||
= link_to (image_tag photo.url(:thumb_small)), post_path(photo)
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@
|
|||
= link_to t('.reshare'), "#"
|
||||
|
||||
%ul.reshare_box
|
||||
= aspect_links(aspects, :prefill => post.message)
|
||||
= aspect_links(aspects, :prefill => post.text)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
- else
|
||||
- for photo in photos[1..photos.size]
|
||||
= link_to (image_tag photo.url(:thumb_small)), photo_path(photo)
|
||||
= markdownify(post.message, :youtube_maps => post[:youtube_titles])
|
||||
= markdownify(post.text, :youtube_maps => post[:youtube_titles])
|
||||
|
||||
- else
|
||||
= markdownify(post.message, :youtube_maps => post[:youtube_titles])
|
||||
= markdownify(post.text, :youtube_maps => post[:youtube_titles])
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#show_text
|
||||
%p
|
||||
= markdownify(@status_message.message, :youtube_maps => @status_message[:youtube_titles])
|
||||
= markdownify(@status_message.text, :youtube_maps => @status_message[:youtube_titles])
|
||||
|
||||
- for photo in @status_message.photos
|
||||
= link_to (image_tag photo.url(:thumb_small)), photo_path(photo)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
= render 'shared/author_info', :person => @status_message.author, :post => @status_message
|
||||
|
||||
%p
|
||||
= markdownify(@status_message.message, :youtube_maps => @status_message[:youtube_titles])
|
||||
= markdownify(@status_message.text, :youtube_maps => @status_message[:youtube_titles])
|
||||
|
||||
- for photo in @status_message.photos
|
||||
= link_to (image_tag photo.url(:thumb_small)), photo.url(:thumb_medium)
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class Postzord::Dispatch
|
|||
if @object.respond_to?(:public) && @object.public
|
||||
deliver_to_hub
|
||||
end
|
||||
if @object.respond_to?(:message)
|
||||
if @object.instance_of?(StatusMessage)
|
||||
services.each do |service|
|
||||
Resque.enqueue(Job::PostToService, service.id, @object.id, url)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ describe AspectsController do
|
|||
connect_users(@alice, @alices_aspect_1, user, aspect)
|
||||
post = @alice.post(:status_message, :text => "hello#{n}", :to => @alices_aspect_2.id)
|
||||
8.times do |n|
|
||||
user.comment "yo#{post.message}", :on => post
|
||||
user.comment "yo#{post.text}", :on => post
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ describe PeopleController do
|
|||
end
|
||||
@posts.each do |post|
|
||||
@users.each do |user|
|
||||
user.comment "yo#{post.message}", :on => post
|
||||
user.comment "yo#{post.text}", :on => post
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ describe SocketsController do
|
|||
|
||||
it 'actionhashes posts' do
|
||||
json = @controller.action_hash(@user, @message)
|
||||
json.include?(@message.message).should be_true
|
||||
json.include?(@message.text).should be_true
|
||||
json.include?('status_message').should be_true
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ describe StatusMessagesController do
|
|||
old_status_message = @user1.post(:status_message, :text => "hello", :to => @aspect1.id)
|
||||
status_message_hash[:status_message][:id] = old_status_message.id
|
||||
post :create, status_message_hash
|
||||
old_status_message.reload.message.should == 'hello'
|
||||
old_status_message.reload.text.should == 'hello'
|
||||
end
|
||||
|
||||
it 'calls dispatch post once subscribers is set' do
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ describe UsersController do
|
|||
it 'renders xml' do
|
||||
sm = Factory(:status_message, :public => true, :author => @user.person)
|
||||
get :public, :username => @user.username
|
||||
response.body.should include(sm.message)
|
||||
response.body.should include(sm.text)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ describe 'a user receives a post' do
|
|||
|
||||
receive_with_zord(@user2, @user1.person, xml)
|
||||
|
||||
status.reload.message.should == 'store this!'
|
||||
status.reload.text.should == 'store this!'
|
||||
end
|
||||
|
||||
it 'updates posts marked as mutable' do
|
||||
|
|
|
|||
|
|
@ -89,9 +89,9 @@ describe Diaspora::Exporter do
|
|||
context '<posts>' do
|
||||
let(:posts_xml) {exported.xpath('//posts').to_s}
|
||||
it 'should include many posts xml' do
|
||||
posts_xml.should include @status_message1.message
|
||||
posts_xml.should include @status_message2.message
|
||||
posts_xml.should_not include @status_message3.message
|
||||
posts_xml.should include @status_message1.text
|
||||
posts_xml.should include @status_message2.text
|
||||
posts_xml.should_not include @status_message3.text
|
||||
end
|
||||
|
||||
it 'should include post created at time' do
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ describe Diaspora::OstatusBuilder do
|
|||
let!(:atom) { director = Diaspora::Director.new; director.build(Diaspora::OstatusBuilder.new(user, public_status_messages)) }
|
||||
|
||||
it 'should include a users posts' do
|
||||
public_status_messages.each{ |status| atom.should include status.message }
|
||||
public_status_messages.each{ |status| atom.should include status.text}
|
||||
end
|
||||
|
||||
it 'should iterate through all objects, and not stop if it runs into a post without a to_activity' do
|
||||
messages = public_status_messages.collect{|x| x.message}
|
||||
messages = public_status_messages.collect{|x| x.text}
|
||||
public_status_messages.insert(1, [])
|
||||
director = Diaspora::Director.new;
|
||||
atom2 = director.build(Diaspora::OstatusBuilder.new(user, public_status_messages))
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ describe Notifier do
|
|||
end
|
||||
|
||||
it 'has the post text in the body' do
|
||||
@mail.body.encoded.should include(@sm.message)
|
||||
@mail.body.encoded.should include(@sm.text)
|
||||
end
|
||||
|
||||
it 'should not include translation missing' do
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe Services::Facebook do
|
|||
|
||||
describe '#post' do
|
||||
it 'posts a status message to facebook' do
|
||||
RestClient.should_receive(:post).with("https://graph.facebook.com/me/feed", :message => @post.message, :access_token => @service.access_token)
|
||||
RestClient.should_receive(:post).with("https://graph.facebook.com/me/feed", :message => @post.text, :access_token => @service.access_token)
|
||||
@service.post(@post)
|
||||
end
|
||||
it 'swallows exception raised by facebook always being down' do
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe Services::Twitter do
|
|||
|
||||
describe '#post' do
|
||||
it 'posts a status message to twitter' do
|
||||
Twitter.should_receive(:update).with(@post.message)
|
||||
Twitter.should_receive(:update).with(@post.text)
|
||||
@service.post(@post)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ describe StatusMessage do
|
|||
message = "Users do things"
|
||||
status = @user.post(:status_message, :text => message, :to => @aspect.id)
|
||||
db_status = StatusMessage.find(status.id)
|
||||
db_status.message.should == message
|
||||
db_status.text.should == message
|
||||
end
|
||||
|
||||
it 'should require status messages to be less than 1000 characters' do
|
||||
|
|
@ -118,7 +118,7 @@ STR
|
|||
describe '#formatted_message' do
|
||||
it 'escapes the message' do
|
||||
xss = "</a> <script> alert('hey'); </script>"
|
||||
@sm.message << xss
|
||||
@sm.text << xss
|
||||
|
||||
@sm.formatted_message.should_not include xss
|
||||
end
|
||||
|
|
@ -235,7 +235,7 @@ STR
|
|||
end
|
||||
it 'serializes the unescaped, unprocessed message' do
|
||||
@message.text = "<script> alert('xss should be federated');</script>"
|
||||
@message.to_xml.to_s.should include @message.message
|
||||
@message.to_xml.to_s.should include @message.text
|
||||
end
|
||||
it 'serializes the message' do
|
||||
@xml.should include "<raw_message>I hate WALRUSES!</raw_message>"
|
||||
|
|
@ -250,7 +250,7 @@ STR
|
|||
@marshalled = StatusMessage.from_xml(@xml)
|
||||
end
|
||||
it 'marshals the message' do
|
||||
@marshalled.message.should == "I hate WALRUSES!"
|
||||
@marshalled.text.should == "I hate WALRUSES!"
|
||||
end
|
||||
it 'marshals the guid' do
|
||||
@marshalled.guid.should == @message.guid
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ describe "attack vectors" do
|
|||
zord = Postzord::Receiver.new(user, :salmon_xml => salmon_xml)
|
||||
zord.perform
|
||||
|
||||
original_message.reload.message.should == "store this!"
|
||||
original_message.reload.text.should == "store this!"
|
||||
end
|
||||
|
||||
it 'does not save a message over an old message with the same author' do
|
||||
|
|
@ -91,8 +91,8 @@ describe "attack vectors" do
|
|||
|
||||
}.should_not change{user.reload.raw_visible_posts.count}
|
||||
|
||||
original_message.reload.message.should == "store this!"
|
||||
user.raw_visible_posts.first.message.should == "store this!"
|
||||
original_message.reload.text.should == "store this!"
|
||||
user.raw_visible_posts.first.text.should == "store this!"
|
||||
end
|
||||
end
|
||||
it 'should not overwrite another persons profile profile' do
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ describe User do
|
|||
describe '#build_post' do
|
||||
it 'sets status_message#message' do
|
||||
post = user.build_post(:status_message, :text => "hey", :to => aspect.id)
|
||||
post.message.should == "hey"
|
||||
post.text.should == "hey"
|
||||
end
|
||||
it 'does not save a status_message' do
|
||||
post = user.build_post(:status_message, :text => "hey", :to => aspect.id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue