initial commit
This commit is contained in:
21
test/gem_rake_bundler/spec/index_spec.rb
Normal file
21
test/gem_rake_bundler/spec/index_spec.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require 'spec_helper'
|
||||
require 'selenium-webdriver'
|
||||
|
||||
describe 'index.html' do
|
||||
before do
|
||||
Encoding.default_external='utf-8'
|
||||
@webserver=start_http()
|
||||
@webdriver = Selenium::WebDriver.for :firefox
|
||||
end
|
||||
|
||||
it "Http get should be successfull." do
|
||||
@webdriver.navigate.to "http://127.0.0.1:10080/index.html"
|
||||
expect(@webdriver.title).to eq "rbenv for Windows test page"
|
||||
end
|
||||
|
||||
after do
|
||||
@webdriver.quit
|
||||
@webserver.shutdown
|
||||
end
|
||||
|
||||
end
|
||||
25
test/gem_rake_bundler/spec/spec_helper.rb
Normal file
25
test/gem_rake_bundler/spec/spec_helper.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
# $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
||||
require 'bundler/setup'
|
||||
require 'webrick'
|
||||
|
||||
def start_http(opt={})
|
||||
s = WEBrick::HTTPServer.new({
|
||||
:DocumentRoot => File.expand_path('../../html', __FILE__),
|
||||
:BindAddress => '127.0.0.1',
|
||||
:Port => 10080,
|
||||
:AccessLog => [[File.open('accesslog.txt', 'w'), WEBrick::AccessLog::CLF]],
|
||||
:Logger => WEBrick::Log.new("log.txt", WEBrick::BasicLog::DEBUG),
|
||||
}.merge(opt).merge({:StartCallback => Proc.new{ Thread.main.wakeup }}))
|
||||
|
||||
trap("INT"){ s.shutdown }
|
||||
@server_thread = Thread.new do
|
||||
s.start
|
||||
end
|
||||
Thread.stop
|
||||
s
|
||||
end
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.filter_run :debug => true
|
||||
config.run_all_when_everything_filtered = true
|
||||
end
|
||||
Reference in New Issue
Block a user