mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00
Use a pipe to test command logging
* JRuby doesn't write to StringIO in the same way as cruby/rbx, and the #read method used in connection_spec didn't work here. * Fixes failure 3 from #615.
This commit is contained in:
parent
3f3ad93888
commit
7816940122
1 changed files with 8 additions and 5 deletions
|
@ -2246,28 +2246,31 @@ describe Capybara::Webkit::Driver do
|
|||
describe "logger app" do
|
||||
it "logs nothing before turning on the logger" do
|
||||
visit("/")
|
||||
@write.close
|
||||
log.should_not include logging_message
|
||||
end
|
||||
|
||||
it "logs its commands after turning on the logger" do
|
||||
driver.enable_logging
|
||||
visit("/")
|
||||
@write.close
|
||||
log.should include logging_message
|
||||
end
|
||||
|
||||
before do
|
||||
@read, @write = IO.pipe
|
||||
end
|
||||
|
||||
let(:logging_message) { 'Wrote response true' }
|
||||
|
||||
let(:driver) do
|
||||
connection = Capybara::Webkit::Connection.new(:stderr => output)
|
||||
connection = Capybara::Webkit::Connection.new(:stderr => @write)
|
||||
browser = Capybara::Webkit::Browser.new(connection)
|
||||
Capybara::Webkit::Driver.new(AppRunner.app, :browser => browser)
|
||||
end
|
||||
|
||||
let(:output) { StringIO.new }
|
||||
|
||||
def log
|
||||
output.rewind
|
||||
output.read
|
||||
@read.read
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue