Sha256: c88b8dac738f549878d9beb21c2127c09fb2cca35db990676dbea2b07202d72d

Contents?: true

Size: 634 Bytes

Versions: 5

Compression:

Stored size: 634 Bytes

Contents

require 'tweet'

RSpec.describe Tweet do
  let(:link) { 'https://someurl.com/' }
  let(:tweet) { Tweet.new(link) }

  context '#to_s' do
    it 'returns a string shorter than 140' do
      expect(tweet.to_s.length).to be < 140
    end
  end

  context '#add' do
    context 'when the tag + @post is < 140' do
      let(:tag) { 'foo' }
      it 'is added' do
        expect(tweet.add(tag)).to eq("| #{tag} | #{link}")
      end
    end
    context 'when the tag + @post is > 140' do
      let(:tag) { 'a' * 140 }
      it 'is not added' do
        expect { tweet.add(tag) }.to raise_error Tweet::TagTooLong
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
awl_tags_twitter-1.0.2 spec/tweet_spec.rb
awl_tags_twitter-1.0.1 spec/tweet_spec.rb
awl_tags_twitter-1.0.0 spec/tweet_spec.rb
awl_tags_twitter-0.0.4 spec/tweet_spec.rb
awl_tags_twitter-0.0.3 spec/tweet_spec.rb