|
24 | 24 | end
|
25 | 25 | end
|
26 | 26 |
|
27 |
| - results[0].keys.should include("second_query") |
28 |
| - results[1].keys.should include("first_query") |
| 27 | + expect(results[0].keys).to include("second_query") |
| 28 | + expect(results[1].keys).to include("first_query") |
29 | 29 | end
|
30 | 30 |
|
31 | 31 | it "should support queries in callbacks" do
|
|
44 | 44 | end
|
45 | 45 | end
|
46 | 46 |
|
47 |
| - results[0].keys.should include("first_query") |
48 |
| - results[1].keys.should include("second_query") |
| 47 | + expect(results[0].keys).to include("first_query") |
| 48 | + expect(results[1].keys).to include("second_query") |
49 | 49 | end
|
50 | 50 |
|
51 | 51 | it "should not swallow exceptions raised in callbacks" do
|
52 |
| - lambda { |
| 52 | + expect { |
53 | 53 | EM.run do
|
54 | 54 | client = Mysql2::EM::Client.new DatabaseCredentials['root']
|
55 | 55 | defer = client.query "SELECT sleep(0.1) as first_query"
|
|
63 | 63 | EM.stop_event_loop
|
64 | 64 | end
|
65 | 65 | end
|
66 |
| - }.should raise_error |
| 66 | + }.to raise_error |
67 | 67 | end
|
68 | 68 |
|
69 | 69 | context 'when an exception is raised by the client' do
|
70 | 70 | let(:client) { Mysql2::EM::Client.new DatabaseCredentials['root'] }
|
71 | 71 | let(:error) { StandardError.new('some error') }
|
72 |
| - before { client.stub(:async_result).and_raise(error) } |
| 72 | + before { allow(client).to receive(:async_result).and_raise(error) } |
73 | 73 |
|
74 | 74 | it "should swallow exceptions raised in by the client" do
|
75 | 75 | errors = []
|
|
85 | 85 | EM.stop_event_loop
|
86 | 86 | end
|
87 | 87 | end
|
88 |
| - errors.should == [error] |
| 88 | + expect(errors).to eq([error]) |
89 | 89 | end
|
90 | 90 |
|
91 | 91 | it "should fail the deferrable" do
|
|
105 | 105 | end
|
106 | 106 | end
|
107 | 107 | end
|
108 |
| - callbacks_run.should == [:errback] |
| 108 | + expect(callbacks_run).to eq([:errback]) |
109 | 109 | end
|
110 | 110 | end
|
111 | 111 |
|
|
121 | 121 | callbacks_run << :errback
|
122 | 122 | end
|
123 | 123 | EM.add_timer(0.1) do
|
124 |
| - callbacks_run.should == [:callback] |
125 |
| - lambda { |
| 124 | + expect(callbacks_run).to eq([:callback]) |
| 125 | + expect { |
126 | 126 | client.close
|
127 |
| - }.should_not raise_error(/invalid binding to detach/) |
| 127 | + }.not_to raise_error |
128 | 128 | EM.stop_event_loop
|
129 | 129 | end
|
130 | 130 | end
|
|
0 commit comments