spec/api/app_session_spec.rb in rest-assured-2.0.0 vs spec/api/app_session_spec.rb in rest-assured-2.0.1
- old
+ new
@@ -2,20 +2,26 @@
require File.expand_path('../../spec_helper', __FILE__)
require File.expand_path('../../../lib/rest-assured/api/app_session', __FILE__)
module RestAssured
describe AppSession do
+ let(:child) do
+ double(io: double, :cwd= => double)
+ end
+
it 'starts application in childprocess' do
cmdargs = %w{-d :memory: -p 6666}
- Config.stub(:to_cmdargs => cmdargs)
+ allow(Config).to receive_messages(:to_cmdargs => cmdargs)
- ChildProcess.should_receive(:build).with('rest-assured', *cmdargs).and_return(child = double(:io => double))
+ expect(ChildProcess).to receive(:build).with('bin/rest-assured', *cmdargs).and_return(child)
+ expect(child).to receive(:cwd=)
+
state = ''
- child.io.should_receive(:inherit!) do
- state.should_not == 'started'
+ expect(child.io).to receive(:inherit!) do
+ expect(state).not_to eq('started')
end
- child.should_receive(:start) do
+ expect(child).to receive(:start) do
state << 'started'
end
AppSession.new
end