From 66afb7baff1a493fdbf14b44b5bbb718be470de3 Mon Sep 17 00:00:00 2001 From: Steven Fuchs Date: Sat, 25 Feb 2012 23:59:02 -0500 Subject: [PATCH] use a stub instead of creating a post to simpy supply text --- spec/models/services/twitter_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/models/services/twitter_spec.rb b/spec/models/services/twitter_spec.rb index e6346eea8..a9152da98 100644 --- a/spec/models/services/twitter_spec.rb +++ b/spec/models/services/twitter_spec.rb @@ -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