Skip to content

Commit 0bd32b3

Browse files
p-mongop
andauthored
MONGOID-5214 add failing test case (#5128)
Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent df0941f commit 0bd32b3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

spec/mongoid/scopable_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,24 @@ class << Band
11721172
end
11731173
end
11741174
end
1175+
1176+
context 'when nesting unsoped under with_scope' do
1177+
let(:c1) { Band.where(active: true) }
1178+
1179+
it 'restores previous scope' do
1180+
pending 'MONGOID-5214'
1181+
1182+
Band.with_scope(c1) do |crit|
1183+
Band.unscoped do |crit2|
1184+
Mongoid::Threaded.current_scope(Band).should be nil
1185+
end
1186+
1187+
Mongoid::Threaded.current_scope(Band).selector.should == {
1188+
'active' => true,
1189+
}
1190+
end
1191+
end
1192+
end
11751193
end
11761194

11771195
describe ".without_default_scope" do

0 commit comments

Comments
 (0)