File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 52
52
end
53
53
end
54
54
55
+ context "when a class method" do
56
+ let ( :criteria ) do
57
+ Band . where ( name : "Depeche Mode" )
58
+ end
59
+
60
+ before do
61
+ class DefaultScopeAsClassMethod
62
+ include Mongoid ::Document
63
+
64
+ def self . default_scope
65
+ criteria
66
+ end
67
+ end
68
+ end
69
+
70
+ after do
71
+ Mongoid . deregister_model ( DefaultScopeAsClassMethod )
72
+ Object . send ( :remove_const , :DefaultScopeAsClassMethod )
73
+ end
74
+
75
+ it "adds the default scope to the class" do
76
+ pending 'https://jira.mongodb.org/browse/MONGOID-5483'
77
+ expect ( DefaultScopeAsClassMethod . default_scoping . call ) . to eq ( criteria )
78
+ end
79
+
80
+ it "flags as being default scoped" do
81
+ pending 'https://jira.mongodb.org/browse/MONGOID-5483'
82
+ expect ( DefaultScopeAsClassMethod ) . to be_default_scoping
83
+ end
84
+ end
85
+
55
86
context "when provided a non proc" do
56
87
57
88
it "raises an error" do
You can’t perform that action at this time.
0 commit comments