-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfind_spec.rb
52 lines (38 loc) · 1.48 KB
/
find_spec.rb
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
require 'spec_helper'
require 'pages/shared/examples'
describe 'Page' do
let(:existing_page_id) { '1191441824276882' }
let(:unknown_page_id) { 'does-not-exist' }
let(:website_url) { 'http://www.imdb.com/title/tt2015381/' }
describe '.find(page_id)' do
let(:page) { Funky::Page.find(page_id) }
context 'given an existing page ID was passed' do
let(:page_id) { existing_page_id }
include_examples 'id and name properties'
include_examples 'location properties'
it { expect(page.fan_count).to be_an(Integer) }
it { expect([true, false]).to include(page.has_featured_video?)}
end
context 'given a non-existing page ID was passed' do
let(:page_id) { unknown_page_id }
it { expect { page }.to raise_error(Funky::ContentNotFound) }
end
context 'given an invalid URI was passed' do
let(:page_id) { ' some invalid URL ' }
it { expect { page }.to raise_error(Funky::ContentNotFound) }
end
context 'given a website url was passed' do
let(:page_id) { website_url }
it { expect { page }.to raise_error(Funky::ContentNotFound) }
end
context 'with invalid app access token' do
before { Funky::Connection::API.instance_variable_set :@app_access_token, 'invalid-token' }
context 'given an existing page ID' do
let(:page_id) { existing_page_id }
specify 'does not raise error by refreshing' do
expect{ page }.not_to raise_error
end
end
end
end
end