initial commit
This commit is contained in:
8
test/gem_rake_bundler/Gemfile
Normal file
8
test/gem_rake_bundler/Gemfile
Normal file
@@ -0,0 +1,8 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
# Specify your gem's dependencies in ariblib.gemspec
|
||||
group :development, :test do
|
||||
gem 'rake'
|
||||
gem 'rspec'
|
||||
gem 'selenium-webdriver'
|
||||
end
|
||||
10
test/gem_rake_bundler/Rakefile
Normal file
10
test/gem_rake_bundler/Rakefile
Normal file
@@ -0,0 +1,10 @@
|
||||
#require "bundler/gem_tasks"
|
||||
require "rspec/core/rake_task"
|
||||
|
||||
RSpec::Core::RakeTask.new(:spec)
|
||||
|
||||
task :default => :spec
|
||||
|
||||
task :init do
|
||||
sh "bundle install --path vendor/bundle"
|
||||
end
|
||||
11
test/gem_rake_bundler/html/index.html
Normal file
11
test/gem_rake_bundler/html/index.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>rbenv for Windows test page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>rbenv for Windows</h1>
|
||||
</body>
|
||||
</html>
|
||||
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