File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def collection_is_open
32
32
end
33
33
end
34
34
35
- scope :include_for_works , -> { includes ( work : :pseuds ) }
35
+ scope :include_for_works , -> { includes ( item : :pseuds ) }
36
36
scope :unrevealed , -> { where ( unrevealed : true ) }
37
37
scope :anonymous , -> { where ( anonymous : true ) }
38
38
Original file line number Diff line number Diff line change 77
77
end
78
78
end
79
79
end
80
+
81
+ describe "include_for_works scope" do
82
+ let ( :collection ) { create ( :collection ) }
83
+ let ( :work ) { create ( :work , id : 63 ) }
84
+ let ( :bookmark ) { create ( :bookmark , id : 63 ) }
85
+
86
+ before { bookmark . collections << collection }
87
+
88
+ it "returns the correct type item for bookmarks" do
89
+ expect ( work . id ) . to eq ( bookmark . id )
90
+ expect ( collection . collection_items ) . not_to be_empty
91
+ expect ( collection . collection_items . first . item_type ) . to eq ( "Bookmark" )
92
+ expect ( collection . collection_items . include_for_works . first . item_type ) . to eq ( "Bookmark" )
93
+ end
94
+ end
80
95
end
You can’t perform that action at this time.
0 commit comments