forked from id774/automaticruby
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpocket_spec.rb
More file actions
57 lines (48 loc) · 1.51 KB
/
pocket_spec.rb
File metadata and controls
57 lines (48 loc) · 1.51 KB
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
# -*- coding: utf-8 -*-
# Name:: Automatic::Plugin::Subscription::Pocket
# Author:: soramugi <http://soramugi.net>
# Created:: May 21, 2013
# Updated:: Feb 25, 2014
# Copyright:: Copyright (c) 2012-2014 Automatic Ruby Developers.
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
require 'subscription/pocket'
def pocket(config = {}, pipeline = [])
Automatic::Plugin::SubscriptionPocket.new(config,pipeline)
end
describe 'Automatic::Plugin::SubscriptionPocket' do
context 'when feed is empty' do
describe 'attestation error' do
subject { pocket }
its(:run) { should be_empty }
end
describe 'interval & retry was used error' do
config = {'interval' => 1, 'retry' => 1}
subject { pocket(config) }
its(:run) { should be_empty }
end
end
context 'when feed' do
describe 'config optional' do
config = { 'optional' => {
'count' => 1,
'favorite' => 1
}}
subject { pocket(config) }
before do
retrieve = {'list' => {
'id' => {
'given_url' => 'http://github.com',
'given_title' => 'GitHub',
'excerpt' => 'github'
}}}
client = double("client")
client.should_receive(:retrieve).
with(config['optional']).
and_return(retrieve)
subject.instance_variable_set(:@client, client)
end
its(:run) { should have(1).item }
end
end
end