File: uri_spec.rb

package info (click to toggle)
ruby-twitter 7.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,856 kB
  • sloc: ruby: 10,919; makefile: 6
file content (72 lines) | stat: -rw-r--r-- 2,371 bytes parent folder | download | duplicates (4)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
require 'helper'

describe Twitter::Entity::URI do
  describe '#display_uri' do
    it 'returns a String when the display_url is set' do
      uri = Twitter::Entity::URI.new(display_url: 'example.com/expanded...')
      expect(uri.display_uri).to be_a String
      expect(uri.display_uri).to eq('example.com/expanded...')
    end
    it 'returns nil when the display_url is not set' do
      uri = Twitter::Entity::URI.new
      expect(uri.display_uri).to be_nil
    end
  end

  describe '#display_uri?' do
    it 'returns true when the display_url is set' do
      uri = Twitter::Entity::URI.new(display_url: 'example.com/expanded...')
      expect(uri.display_uri?).to be true
    end
    it 'returns false when the display_url is not set' do
      uri = Twitter::Entity::URI.new
      expect(uri.display_uri?).to be false
    end
  end

  describe '#expanded_uri' do
    it 'returns a URI when the expanded_url is set' do
      uri = Twitter::Entity::URI.new(expanded_url: 'https://github.com/sferik')
      expect(uri.expanded_uri).to be_an Addressable::URI
      expect(uri.expanded_uri.to_s).to eq('https://github.com/sferik')
    end
    it 'returns nil when the expanded_url is not set' do
      uri = Twitter::Entity::URI.new
      expect(uri.expanded_uri).to be_nil
    end
  end

  describe '#expanded_uri?' do
    it 'returns true when the expanded_url is set' do
      uri = Twitter::Entity::URI.new(expanded_url: 'https://github.com/sferik')
      expect(uri.expanded_uri?).to be true
    end
    it 'returns false when the expanded_url is not set' do
      uri = Twitter::Entity::URI.new
      expect(uri.expanded_uri?).to be false
    end
  end

  describe '#uri' do
    it 'returns a URI when the url is set' do
      uri = Twitter::Entity::URI.new(url: 'https://github.com/sferik')
      expect(uri.uri).to be_an Addressable::URI
      expect(uri.uri.to_s).to eq('https://github.com/sferik')
    end
    it 'returns nil when the url is not set' do
      uri = Twitter::Entity::URI.new
      expect(uri.uri).to be_nil
    end
  end

  describe '#uri?' do
    it 'returns true when the url is set' do
      uri = Twitter::Entity::URI.new(url: 'https://github.com/sferik')
      expect(uri.uri?).to be true
    end
    it 'returns false when the url is not set' do
      uri = Twitter::Entity::URI.new
      expect(uri.uri?).to be false
    end
  end
end