File: variant_spec.rb

package info (click to toggle)
ruby-twitter 7.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,840 kB
  • sloc: ruby: 10,919; makefile: 6
file content (26 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'helper'

describe Twitter::Variant do
  describe '#uri' do
    it 'returns a URI when the url is set' do
      variant = Twitter::Variant.new(id: 1, url: 'https://video.twimg.com/media/BQD6MPOCEAAbCH0.mp4')
      expect(variant.uri).to be_an Addressable::URI
      expect(variant.uri.to_s).to eq('https://video.twimg.com/media/BQD6MPOCEAAbCH0.mp4')
    end
    it 'returns nil when the url is not set' do
      variant = Twitter::Variant.new({})
      expect(variant.uri).to be_nil
    end
  end

  describe '#uri?' do
    it 'returns true when the url is set' do
      variant = Twitter::Variant.new(id: 1, url: 'https://video.twimg.com/media/BQD6MPOCEAAbCH0.mp4')
      expect(variant.uri?).to be true
    end
    it 'returns false when the url is not set' do
      variant = Twitter::Variant.new({})
      expect(variant.uri?).to be false
    end
  end
end