spec/fakeredis_spec.rb in fakeredis-0.7.0 vs spec/fakeredis_spec.rb in fakeredis-0.8.0
- old
+ new
@@ -16,6 +16,58 @@
it 'in memory connection' do
described_class.disable
expect(described_class.enabled?).to be_falsy
end
end
+
+ describe '.disabling' do
+ context 'FakeRedis is enabled' do
+ before { described_class.enable }
+
+ it 'in memory connection' do
+ described_class.disabling do
+ expect(described_class.enabled?).to be_falsy
+ end
+
+ expect(described_class.enabled?).to be_truthy
+ end
+ end
+
+ context 'FakeRedis is disabled' do
+ before { described_class.disable }
+
+ it 'in memory connection' do
+ described_class.disabling do
+ expect(described_class.enabled?).to be_falsy
+ end
+
+ expect(described_class.enabled?).to be_falsy
+ end
+ end
+ end
+
+ describe '.enabling' do
+ context 'FakeRedis is enabled' do
+ before { described_class.enable }
+
+ it 'in memory connection' do
+ described_class.enabling do
+ expect(described_class.enabled?).to be_truthy
+ end
+
+ expect(described_class.enabled?).to be_truthy
+ end
+ end
+
+ context 'FakeRedis is disabled' do
+ before { described_class.disable }
+
+ it 'in memory connection' do
+ described_class.enabling do
+ expect(described_class.enabled?).to be_truthy
+ end
+
+ expect(described_class.enabled?).to be_falsy
+ end
+ end
+ end
end