forked from stringer-rss/stringer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrite_mark_item_spec.rb
More file actions
60 lines (49 loc) · 1.86 KB
/
write_mark_item_spec.rb
File metadata and controls
60 lines (49 loc) · 1.86 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
58
59
60
require "spec_helper"
app_require "fever_api/write_mark_item"
describe FeverAPI::WriteMarkItem do
let(:item_marker) { double('item marker') }
let(:marker_class) { double('marker class') }
describe "as read" do
subject do
FeverAPI::WriteMarkItem.new(read_marker_class: marker_class)
end
it "instantiates an item marker and calls mark_item_as_read if requested" do
marker_class.should_receive(:new).with(5).and_return(item_marker)
item_marker.should_receive(:mark_as_read)
subject.call(mark: 'item', as: 'read', id: 5).should == {}
end
end
describe "as unread" do
subject do
FeverAPI::WriteMarkItem.new(unread_marker_class: marker_class)
end
it "instantiates an item marker and calls mark_item_as_unread if requested" do
marker_class.should_receive(:new).with(5).and_return(item_marker)
item_marker.should_receive(:mark_as_unread)
subject.call(mark: 'item', as: 'unread', id: 5).should == {}
end
end
describe "as starred" do
subject do
FeverAPI::WriteMarkItem.new(starred_marker_class: marker_class)
end
it "instantiates an item marker and calls mark_item_as_starred if requested" do
marker_class.should_receive(:new).with(5).and_return(item_marker)
item_marker.should_receive(:mark_as_starred)
subject.call(mark: 'item', as: 'saved', id: 5).should == {}
end
end
describe "as unstarred" do
subject do
FeverAPI::WriteMarkItem.new(unstarred_marker_class: marker_class)
end
it "instantiates an item marker and calls mark_item_as_unstarred if requested" do
marker_class.should_receive(:new).with(5).and_return(item_marker)
item_marker.should_receive(:mark_as_unstarred)
subject.call(mark: 'item', as: 'unsaved', id: 5).should == {}
end
end
it "returns an empty hash otherwise" do
subject.call.should == {}
end
end