Skip to content

Commit

Permalink
Add support by rake test
Browse files Browse the repository at this point in the history
* Use `*_test.rb` as file name
* Update sbsm for ARGV issue
  • Loading branch information
Yasuhiro Asaka committed Aug 8, 2016
1 parent d69eb8a commit ebf0a66
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 21 deletions.
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,28 @@ gem 'rmagick', '~> 2.15.4'
gem 'rclconf', '1.0.0'
gem 'ftools', '0.0.0'

gem 'sbsm', '~> 1.2.8'
gem 'sbsm', '~> 1.2.9'
gem 'htmlgrid', '~> 1.1.1'
gem 'odba', '~> 1.1.0'

gem 'yus', '1.0.1'


# FIXME: following gems are needed as dependencies for yus
gem 'deprecated', '2.0.1'
gem 'needle', '1.3.0'
gem 'pg', '0.18.4'
gem 'dbd-pg', '0.3.9'


group :test do
gem 'minitest', '~> 5.9'
gem 'watir-webdriver'
gem 'headless'
end

group :development, :test do
gem 'rake', '~> 11.2'
end

# NOTE: additional personal Gemfile.hack support for developer
#
# @example
Expand Down
6 changes: 4 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ GEM
ydbi (>= 0.5.1)
pg (0.18.4)
rack (2.0.1)
rake (11.2.2)
rclconf (1.0.0)
rmagick (2.15.4)
rubyzip (1.2.0)
sbsm (1.2.8)
sbsm (1.2.9)
hpricot
mail
rack
Expand Down Expand Up @@ -64,9 +65,10 @@ DEPENDENCIES
needle (= 1.3.0)
odba (~> 1.1.0)
pg (= 0.18.4)
rake (~> 11.2)
rclconf (= 1.0.0)
rmagick (~> 2.15.4)
sbsm (~> 1.2.8)
sbsm (~> 1.2.9)
watir-webdriver
yus (= 1.0.1)

Expand Down
15 changes: 15 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
src = File.expand_path('../src', __FILE__)
$: << src unless $:.include?(src)

require 'rake/testtask'
require 'rake/clean'

task :default => :test

dir = File.dirname(__FILE__)
Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = Dir.glob("#{dir}/test/**/*_test.rb")
t.warning = false
t.verbose = false
end
File renamed without changes.
2 changes: 1 addition & 1 deletion test/support/stub/http_server.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'webrick'
require 'sbsm/request'
require 'util/trans_handler'
require 'webrick'

class Object
def meta_class; class << self; self; end; end
Expand Down
15 changes: 4 additions & 11 deletions test/support/stub/yus_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ class User
attr_reader :valid

def allowed?(action, site)
if action=='edit' && site =='com.davaz'
true
else
false
end
action == 'edit' && site =='com.davaz'
end

def valid?
Expand All @@ -22,12 +18,9 @@ def valid?
class YusServer

def login(email, pass, config)
puts "email: #{email}, pass: #{pass}, config: #{config}"
if email == 'right@user.ch'
User.new
else
raise Yus::YusError
end
# puts "email: #{email}, pass: #{pass}, config: #{config}"
raise Yus::YusError unless email != 'right@user.ch'
User.new
end

def logout(arg)
Expand Down
13 changes: 9 additions & 4 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
require 'pathname'

root_dir = Pathname.new(__FILE__).parent.parent.expand_path
$: << root_dir.join('src')

src = root_dir.join('src')
$: << src unless $:.include?(src)

test = root_dir.join('test')
$: << test unless $:.include?(test)

require 'minitest'
require 'minitest/autorun'
Expand All @@ -10,14 +15,14 @@
require 'davaz'
require 'util/config'

Dir[root_dir.join('test/support/**/*.rb')].each { |f| require f }

module DaVaz
module Stub; end
end

Dir[root_dir.join('test/support/**/*.rb')].each { |f| require f }

DaVaz.config.document_root = root_dir.join('doc')
DaVaz.config.autologin = false
DaVaz.config.autologin = false

DEBUG = (ENV['DEBUG'] == 'true' || false)
TEST_SRV_URI = URI.parse(ENV['TEST_SRV_HOST'] || 'http://127.0.0.1:10080')
Expand Down

0 comments on commit ebf0a66

Please sign in to comment.