live_paper 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +8 -0
- data/lib/live_paper.rb +24 -113
- data/lib/live_paper/base_object.rb +82 -0
- data/lib/live_paper/http_client.rb +80 -0
- data/lib/live_paper/image.rb +32 -0
- data/lib/live_paper/link.rb +46 -0
- data/lib/live_paper/payoff.rb +78 -0
- data/lib/live_paper/qr_trigger.rb +44 -0
- data/lib/live_paper/short_trigger.rb +37 -0
- data/lib/live_paper/version.rb +1 -1
- data/lib/live_paper/wm_trigger.rb +52 -0
- data/live_paper.gemspec +3 -1
- data/spec/live_paper/base_object_spec.rb +200 -0
- data/spec/live_paper/http_client_spec.rb +182 -0
- data/spec/live_paper/link_spec.rb +183 -0
- data/spec/live_paper/payoff_spec.rb +220 -0
- data/spec/live_paper/trigger_spec.rb +134 -0
- data/spec/live_paper_session_spec.rb +16 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/spec_helpers/lpp_client.rb +75 -0
- metadata +55 -3
@@ -0,0 +1,183 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LivePaper::WmTrigger do
|
4
|
+
before do
|
5
|
+
stub_request(:post, /.*livepaperapi.com\/auth\/token.*/).to_return(:body => lpp_auth_response_json, :status => 200)
|
6
|
+
stub_request(:post, LivePaper::Link.api_url).to_return(:body => lpp_link_response_json, :status => 200)
|
7
|
+
stub_request(:get, "#{LivePaper::Link.api_url}/link_id").to_return(:body => lpp_link_response_json, :status => 200)
|
8
|
+
stub_request(:get, "#{LivePaper::Link.api_url}/link_not_existent").to_return(:body => '{}', :status => 404)
|
9
|
+
|
10
|
+
@data = {
|
11
|
+
id: 'id',
|
12
|
+
name: 'name',
|
13
|
+
analytics: 'analytics',
|
14
|
+
trigger_id: 'trigger_id',
|
15
|
+
payoff_id: 'payoff_id'
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#initialize' do
|
20
|
+
before do
|
21
|
+
@link = LivePaper::Link.new @data
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should map the analytics attribute.' do
|
25
|
+
expect(@link.analytics).to eq @data[:analytics]
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should map the trigger_id attribute.' do
|
29
|
+
expect(@link.trigger_id).to eq @data[:trigger_id]
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should map the payoff_id attribute.' do
|
33
|
+
expect(@link.payoff_id).to eq @data[:payoff_id]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#save' do
|
38
|
+
context 'when all needed attributes are provided,' do
|
39
|
+
before do
|
40
|
+
@data.delete :id
|
41
|
+
@link = LivePaper::Link.new @data
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should make a POST to the link URL with body.' do
|
45
|
+
@link.save
|
46
|
+
assert_requested :post, LivePaper::Link.api_url, :body => {
|
47
|
+
link: {
|
48
|
+
name: 'name',
|
49
|
+
triggerId: 'trigger_id',
|
50
|
+
payoffId: 'payoff_id'
|
51
|
+
}
|
52
|
+
}.to_json
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when we do not have all needed data,' do
|
57
|
+
it 'should raise exception if the trigger_id is no provided.' do
|
58
|
+
@data.delete :trigger_id
|
59
|
+
link = LivePaper::Link.new @data
|
60
|
+
expect { link.save }.to raise_error
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should raise exception if the payoff_id is no provided.' do
|
64
|
+
@data.delete :payoff_id
|
65
|
+
link = LivePaper::Link.new @data
|
66
|
+
expect { link.save }.to raise_error
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#parse' do
|
72
|
+
before do
|
73
|
+
@link = LivePaper::Link.parse(lpp_link_response_json)
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should return a Link object.' do
|
77
|
+
expect(@link.class).to eq LivePaper::Link
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should map the id attribute.' do
|
81
|
+
expect(@link.id).to eq 'link_id'
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should map the name attribute.' do
|
85
|
+
expect(@link.name).to eq 'name'
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'should map the analytics attribute.' do
|
89
|
+
expect(@link.analytics).to eq 'analytics'
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should map the trigger_id attribute.' do
|
93
|
+
expect(@link.trigger_id).to eq 'trigger_id'
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should map the payoff_id attribute.' do
|
97
|
+
expect(@link.payoff_id).to eq 'payoff_id'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe '.find' do
|
102
|
+
context 'the requested Link exists.' do
|
103
|
+
before do
|
104
|
+
@link = LivePaper::Link.find('link_id')
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should return the requested link.' do
|
108
|
+
expect(@link.id).to eq 'link_id'
|
109
|
+
expect(@link.name).to eq 'name'
|
110
|
+
expect(@link.analytics).to eq 'analytics'
|
111
|
+
expect(@link.trigger_id).to eq 'trigger_id'
|
112
|
+
expect(@link.payoff_id).to eq 'payoff_id'
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
context 'the requested link does not exist or some error happened.' do
|
117
|
+
it 'should not raise error.' do
|
118
|
+
expect { LivePaper::Link.find('link_not_existent') }.to_not raise_error
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'should return nil.' do
|
122
|
+
expect(LivePaper::Link.find('link_not_existent')).to eq nil
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe '#trigger' do
|
128
|
+
before do
|
129
|
+
stub_request(:get, "#{LivePaper::WmTrigger.api_url}/trigger_id").to_return(:body => lpp_trigger_response_json, :status => 200)
|
130
|
+
stub_request(:get, "#{LivePaper::WmTrigger.api_url}/trigger_not_existent").to_return(:body => '{}', :status => 404)
|
131
|
+
end
|
132
|
+
|
133
|
+
context 'the trigger_id attribute is from a valid trigger.' do
|
134
|
+
before do
|
135
|
+
@link = LivePaper::Link.new @data
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'should return a Trigger Object.' do
|
139
|
+
expect(@link.trigger.class).to eq LivePaper::WmTrigger
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
context 'the trigger_id attribute is not valid.' do
|
144
|
+
before do
|
145
|
+
@data[:trigger_id] = 'trigger_not_existent'
|
146
|
+
@link = LivePaper::Link.new @data
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'should return nil.' do
|
150
|
+
expect(@link.trigger).to eq nil
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
describe '#payoff' do
|
156
|
+
before do
|
157
|
+
stub_request(:get, "#{LivePaper::Payoff.api_url}/payoff_id").to_return(:body => lpp_payoff_response_json, :status => 200)
|
158
|
+
stub_request(:get, "#{LivePaper::Payoff.api_url}/payoff_not_existent").to_return(:body => '{}', :status => 404)
|
159
|
+
end
|
160
|
+
|
161
|
+
context 'the payoff_id attribute is from a valid payoff.' do
|
162
|
+
before do
|
163
|
+
@link = LivePaper::Link.new @data
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'should return a Payoff Object.' do
|
167
|
+
expect(@link.payoff.class).to eq LivePaper::Payoff
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
context 'the payoff_id attribute is not valid.' do
|
172
|
+
before do
|
173
|
+
@data[:payoff_id] = 'payoff_not_existent'
|
174
|
+
@link = LivePaper::Link.new @data
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'should return nil.' do
|
178
|
+
expect(@link.payoff).to eq nil
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
@@ -0,0 +1,220 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe LivePaper::Payoff do
|
4
|
+
before do
|
5
|
+
stub_request(:post, /.*livepaperapi.com\/auth\/token.*/).to_return(:body => lpp_auth_response_json, :status => 200)
|
6
|
+
stub_request(:post, LivePaper::Payoff.api_url).to_return(:body => lpp_richpayoff_response_json, :status => 200)
|
7
|
+
stub_request(:get, "#{LivePaper::Payoff.api_url}/payoff_id").to_return(:body => lpp_payoff_response_json, :status => 200)
|
8
|
+
stub_request(:get, "#{LivePaper::Payoff.api_url}/payoff_not_existent").to_return(:body => '{}', :status => 404)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#initialize' do
|
12
|
+
before do
|
13
|
+
@data = {
|
14
|
+
id: 'id',
|
15
|
+
name: 'name',
|
16
|
+
type: 'type',
|
17
|
+
url: 'url',
|
18
|
+
data_type: 'data_type',
|
19
|
+
data: 'data'
|
20
|
+
}
|
21
|
+
@payoff = LivePaper::Payoff.new @data
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should map the type attribute.' do
|
25
|
+
expect(@payoff.type).to eq @data[:type]
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should map the url attribute.' do
|
29
|
+
expect(@payoff.url).to eq @data[:url]
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should map the data_type attribute.' do
|
33
|
+
expect(@payoff.data_type).to eq @data[:data_type]
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should map the data attribute.' do
|
37
|
+
expect(@payoff.data).to eq @data[:data]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#save' do
|
42
|
+
context 'all needed attributes are provided.' do
|
43
|
+
context 'payoff type is RICH_PAYOFF.' do
|
44
|
+
before :each do
|
45
|
+
@data = {
|
46
|
+
name: 'name',
|
47
|
+
type: LivePaper::Payoff::TYPE[:RICH],
|
48
|
+
url: 'url',
|
49
|
+
data_type: 'data_type',
|
50
|
+
data: 'data'
|
51
|
+
}
|
52
|
+
@payoff = LivePaper::Payoff.new @data
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should make a POST to the payoff URL with the richpayoff options hash.' do
|
56
|
+
@payoff.save
|
57
|
+
assert_requested :post, LivePaper::Payoff.api_url, :body => {
|
58
|
+
payoff: {
|
59
|
+
name: 'name',
|
60
|
+
richPayoff: {
|
61
|
+
version: 1,
|
62
|
+
private: {
|
63
|
+
:'content-type' => 'data_type',
|
64
|
+
:data => 'data'
|
65
|
+
},
|
66
|
+
public: {
|
67
|
+
url: 'url'
|
68
|
+
}
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}.to_json
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'payoff type is WEB_PAYOFF.' do
|
76
|
+
before :each do
|
77
|
+
@data = {
|
78
|
+
name: 'name',
|
79
|
+
type: LivePaper::Payoff::TYPE[:WEB],
|
80
|
+
url: 'url'
|
81
|
+
}
|
82
|
+
@payoff = LivePaper::Payoff.new @data
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'should make a POST to the payoff URL with the webpayoff options hash.' do
|
86
|
+
@payoff.save
|
87
|
+
assert_requested :post, LivePaper::Payoff.api_url, :body => {
|
88
|
+
payoff: {
|
89
|
+
name: @data[:name],
|
90
|
+
URL: @data[:url]
|
91
|
+
}
|
92
|
+
}.to_json
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'when we do not have all needed data.' do
|
99
|
+
before :each do
|
100
|
+
@data = {
|
101
|
+
name: 'name',
|
102
|
+
type: LivePaper::Payoff::TYPE[:WEB],
|
103
|
+
url: 'url'
|
104
|
+
}
|
105
|
+
@payoff = LivePaper::Payoff.new @data
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'should raise an exception if the name was not provided.' do
|
109
|
+
@payoff.name = nil
|
110
|
+
expect { @payoff.save }.to raise_error ArgumentError
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should raise an exception if the type was not provided.' do
|
114
|
+
@payoff.type = nil
|
115
|
+
expect { @payoff.save }.to raise_error ArgumentError
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'should raise an exception a unsupported type was provided.' do
|
119
|
+
@payoff.type = 'unsupported type'
|
120
|
+
expect { @payoff.save }.to raise_error ArgumentError
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'should raise an exception if the url was not provided.' do
|
124
|
+
@payoff.url = nil
|
125
|
+
expect { @payoff.save }.to raise_error ArgumentError
|
126
|
+
end
|
127
|
+
|
128
|
+
context 'payoff type is RICH_PAYOFF.' do
|
129
|
+
before :each do
|
130
|
+
@data = {
|
131
|
+
name: 'name',
|
132
|
+
type: LivePaper::Payoff::TYPE[:RICH],
|
133
|
+
url: 'url',
|
134
|
+
data_type: 'data_type',
|
135
|
+
data: 'data'
|
136
|
+
}
|
137
|
+
@payoff = LivePaper::Payoff.new @data
|
138
|
+
end
|
139
|
+
it 'should raise an exception if the data_type was not provided.' do
|
140
|
+
@payoff.data_type = nil
|
141
|
+
expect { @payoff.save }.to raise_error ArgumentError
|
142
|
+
end
|
143
|
+
it 'should raise an exception if the data was not provided.' do
|
144
|
+
@payoff.data = nil
|
145
|
+
expect { @payoff.save }.to raise_error ArgumentError
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
describe '#parse' do
|
152
|
+
before do
|
153
|
+
@payoff = LivePaper::Payoff.parse(lpp_payoff_response_json)
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'should return a Payoff object.' do
|
157
|
+
expect(@payoff.class).to eq LivePaper::Payoff
|
158
|
+
end
|
159
|
+
|
160
|
+
it 'should map the id attribute.' do
|
161
|
+
expect(@payoff.id).to eq 'payoff_id'
|
162
|
+
end
|
163
|
+
it 'should map the name attribute.' do
|
164
|
+
expect(@payoff.name).to eq 'name'
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'should map the url attribute.' do
|
168
|
+
expect(@payoff.url).to eq 'url'
|
169
|
+
end
|
170
|
+
|
171
|
+
context 'when the data is from a web payoff.' do
|
172
|
+
it 'should map the payoff type attribute.' do
|
173
|
+
expect(@payoff.type).to eq LivePaper::Payoff::TYPE[:WEB]
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
context 'when the data is from a rich payoff.' do
|
178
|
+
before do
|
179
|
+
@payoff = LivePaper::Payoff.parse(lpp_richpayoff_response_json)
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'should map the payoff type attribute.' do
|
183
|
+
expect(@payoff.type).to eq LivePaper::Payoff::TYPE[:RICH]
|
184
|
+
end
|
185
|
+
|
186
|
+
it 'should map the data_type attribute.' do
|
187
|
+
expect(@payoff.data_type).to eq 'data_type'
|
188
|
+
end
|
189
|
+
it 'should map the data attribute.' do
|
190
|
+
expect(@payoff.data).to eq ({field: 1})
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe '.find' do
|
196
|
+
context 'the requested payoff exists.' do
|
197
|
+
before do
|
198
|
+
@payoff = LivePaper::Payoff.find('payoff_id')
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'should return the requested payoff.' do
|
202
|
+
expect(@payoff.id).to eq 'payoff_id'
|
203
|
+
expect(@payoff.name).to eq 'name'
|
204
|
+
expect(@payoff.url).to eq 'url'
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
context 'the requested payoff does not exist or some error happened.' do
|
210
|
+
it 'should not raise error.' do
|
211
|
+
expect { LivePaper::Payoff.find('payoff_not_existent') }.to_not raise_error
|
212
|
+
end
|
213
|
+
|
214
|
+
it 'should return nil.' do
|
215
|
+
expect(LivePaper::Payoff.find('payoff_not_existent')).to eq nil
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
DOWNLOAD_URL = "https://watermark.livepaperapi.com/watermark/v1/triggers"
|
4
|
+
|
5
|
+
describe LivePaper::WmTrigger do
|
6
|
+
before do
|
7
|
+
stub_request(:post, /.*livepaperapi.com\/auth\/token.*/).to_return(:body => lpp_auth_response_json, :status => 200)
|
8
|
+
stub_request(:post, LivePaper::WmTrigger.api_url).to_return(:body => lpp_trigger_response_json, :status => 200)
|
9
|
+
stub_request(:get, 'https://fileapi/id/image').to_return(:body => lpp_watermark_response, :status => 200)
|
10
|
+
stub_request(:get, "#{LivePaper::WmTrigger.api_url}/trigger_id").to_return(:body => lpp_trigger_response_json, :status => 200)
|
11
|
+
stub_request(:get, "#{LivePaper::WmTrigger.api_url}/trigger_not_existent").to_return(:body => '{}', :status => 404)
|
12
|
+
|
13
|
+
@data = {
|
14
|
+
id: 'id',
|
15
|
+
name: 'name',
|
16
|
+
watermark: {strength: 10, imageURL: 'url'},
|
17
|
+
subscription: 'subscription'
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#initialize' do
|
22
|
+
before do
|
23
|
+
@trigger = LivePaper::WmTrigger.new @data
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should map the watermark attribute.' do
|
27
|
+
expect(@trigger.watermark).to eq @data[:watermark]
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should map the subscription attribute.' do
|
31
|
+
expect(@trigger.subscription).to eq @data[:subscription]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#save' do
|
36
|
+
context 'when all needed attributes are provided,' do
|
37
|
+
before do
|
38
|
+
@data.delete :id
|
39
|
+
@trigger = LivePaper::WmTrigger.new @data
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should make a POST to the trigger URL with body.' do
|
43
|
+
@trigger.save
|
44
|
+
assert_requested :post, LivePaper::WmTrigger.api_url, :body => {
|
45
|
+
trigger: {
|
46
|
+
name: 'name',
|
47
|
+
watermark: {
|
48
|
+
outputImageFormat: 'JPEG',
|
49
|
+
resolution: 75,
|
50
|
+
strength: 10,
|
51
|
+
imageURL: 'url'
|
52
|
+
},
|
53
|
+
subscription: {package: 'month'}
|
54
|
+
}
|
55
|
+
}.to_json
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'when we do not have all needed data,' do
|
60
|
+
it 'should raise exception if the name is no provided.' do
|
61
|
+
@data.delete :name
|
62
|
+
trigger = LivePaper::WmTrigger.new @data
|
63
|
+
expect { trigger.save }.to raise_error
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'should raise exception if the watermark is no provided.' do
|
67
|
+
@data.delete :watermark
|
68
|
+
trigger = LivePaper::WmTrigger.new @data
|
69
|
+
expect { trigger.save }.to raise_error
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '#parse' do
|
75
|
+
before do
|
76
|
+
@trigger = LivePaper::WmTrigger.parse(lpp_trigger_response_json)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should return a Trigger object.' do
|
80
|
+
expect(@trigger.class).to eq LivePaper::WmTrigger
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should map the id attribute.' do
|
84
|
+
expect(@trigger.id).to eq 'trigger_id'
|
85
|
+
end
|
86
|
+
it 'should map the name attribute.' do
|
87
|
+
expect(@trigger.name).to eq 'name'
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should map the watermark attribute.' do
|
91
|
+
expect(@trigger.watermark).to eq 'watermark'
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should map the subscription attribute.' do
|
95
|
+
expect(@trigger.subscription).to eq 'subscription'
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe '.find' do
|
100
|
+
context 'the requested trigger exists.' do
|
101
|
+
before do
|
102
|
+
@trigger = LivePaper::WmTrigger.find('trigger_id')
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'should return the requested trigger.' do
|
106
|
+
expect(@trigger.id).to eq 'trigger_id'
|
107
|
+
expect(@trigger.name).to eq 'name'
|
108
|
+
expect(@trigger.watermark).to eq 'watermark'
|
109
|
+
expect(@trigger.subscription).to eq 'subscription'
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'the requested trigger does not exist or some error happened.' do
|
114
|
+
it 'should not raise error.' do
|
115
|
+
expect { LivePaper::WmTrigger.find('trigger_not_existent') }.to_not raise_error
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'should return nil.' do
|
119
|
+
expect(LivePaper::WmTrigger.find('trigger_not_existent')).to eq nil
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
describe '#download_watermark' do
|
125
|
+
before do
|
126
|
+
@trigger = LivePaper::WmTrigger.new @data
|
127
|
+
@trigger.wm_url='https://fileapi/id/image'
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'should return the watermark image data.' do
|
131
|
+
expect(@trigger.download_watermark).to eq 'watermark_data'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|