use a stub instead of creating a post to simpy supply text
This commit is contained in:
parent
487c404d0d
commit
66afb7baff
1 changed files with 5 additions and 5 deletions
|
|
@ -35,17 +35,17 @@ describe Services::Twitter do
|
|||
|
||||
it "should not truncate a short message" do
|
||||
short_message = ActiveSupport::SecureRandom.hex(20)
|
||||
short_post = @user.post(:status_message, :text => short_message, :to =>@user.aspects.first.id)
|
||||
short_post = stub(:text => short_message )
|
||||
@service.public_message(short_post, '').should == short_message
|
||||
end
|
||||
it "should truncate a long message" do
|
||||
long_message = ActiveSupport::SecureRandom.hex(220)
|
||||
long_post = @user.post(:status_message, :text => long_message, :to =>@user.aspects.first.id)
|
||||
long_post = stub(:text => long_message )
|
||||
@service.public_message(long_post, '').should == long_message.first(137) + "..."
|
||||
end
|
||||
it "should not truncate a long message with an http url" do
|
||||
long_message = @long_message_start + " http://joindiaspora.com/a-very-long-url-name-that-will-be-shortened.html " + @long_message_end
|
||||
long_post = @user.post(:status_message, :text => long_message, :to =>@user.aspects.first.id)
|
||||
long_post = stub(:text => long_message )
|
||||
answer = @service.public_message(long_post, '')
|
||||
|
||||
answer.starts_with?( @long_message_start ).should be_true
|
||||
|
|
@ -53,7 +53,7 @@ describe Services::Twitter do
|
|||
end
|
||||
it "should not truncate a long message with an https url" do
|
||||
long_message = @long_message_start + " https://joindiaspora.com/a-very-long-url-name-that-will-be-shortened.html " + @long_message_end
|
||||
long_post = @user.post(:status_message, :text => long_message, :to =>@user.aspects.first.id)
|
||||
long_post = stub(:text => long_message )
|
||||
|
||||
answer = @service.public_message(long_post, '')
|
||||
answer.starts_with?( @long_message_start ).should be_true
|
||||
|
|
@ -61,7 +61,7 @@ describe Services::Twitter do
|
|||
end
|
||||
it "should truncate a long message with an ftp url" do
|
||||
long_message = @long_message_start + " ftp://joindiaspora.com/a-very-long-url-name-that-will-be-shortened.html " + @long_message_end
|
||||
long_post = @user.post(:status_message, :text => long_message, :to =>@user.aspects.first.id)
|
||||
long_post = stub(:text => long_message )
|
||||
answer = @service.public_message(long_post, '')
|
||||
|
||||
answer.starts_with?( @long_message_start ).should be_true
|
||||
|
|
|
|||
Loading…
Reference in a new issue