Skip to content

Commit

Permalink
added specs for the issue thoughtbot#220
Browse files Browse the repository at this point in the history
  • Loading branch information
dnagir committed Feb 19, 2012
1 parent 89525db commit d596cb4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/browser_spec.rb
Expand Up @@ -175,4 +175,27 @@
@proxy_requests.size.should == 0
end
end


describe '#read_response' do
let(:out) { stub 'OUT', gets: line }
let(:browser) { Capybara::Driver::Webkit::Browser.new(:stdout => out) }
subject { browser.read_response }

context "when there's something to read" do
let(:line) { '3' }
it "should read from socket" do
out.should_receive(:read).with(3).and_return 'abc'
subject
end
end
context "when there nothing to read" do
let(:line) { '' }
it "should not read from socket" do
out.should_not_receive(:read)
subject
end
end
end

end

0 comments on commit d596cb4

Please sign in to comment.