initial commit

This commit is contained in:
2023-07-01 07:23:51 +01:00
commit 984322d789
29 changed files with 1772 additions and 0 deletions

View 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

View 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

View 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>

View 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

View 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