Sha256: 3591cd1f34c3684307c9448eeed8e8bf916326f7c7aa1ba778b66cbf0710e9de
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
require 'phantomjs' describe Phantomjs do describe ".run" do describe 'when phantomjs is non installed' do before { Phantomjs::EXEC = 'not_existing_phantomjs' } after { Phantomjs::EXEC = 'phantomjs' } it "raises an error" do script = File.expand_path('./spec/runner.js') expect { Phantomjs.run(script, 'foo1', 'foo2') }.to raise_error(Phantomjs::CommandNotFoundError) end end it 'raises an error when the script does not exist' do script = File.expand_path('./doesnt_exist.js') expect { Phantomjs.run(script) }.to raise_error(Phantomjs::NoSuchPathError) end it "runs phantomjs binary with the correct arguments" do script = File.expand_path('./spec/runner.js') result = Phantomjs.run(script, 'foo1', 'foo2') result.should eq("bar foo1 foo2\n") end it "accepts a block that will get called for each line of output" do line = '' script = File.expand_path('./spec/runner.js') Phantomjs.run(script, 'foo1', 'foo2') do |l| line << l end line.should eq("bar foo1 foo2\n") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phantomjs.rb-1.0.1 | spec/phantomjs_spec.rb |
phantomjs.rb-1.0.0 | spec/phantomjs_spec.rb |