Commit 39cfa56b authored by Cool Fire's avatar Cool Fire

Introduce coverage testing

parent 4f6c2bb8
Pipeline #366 passed with stages
in 2 minutes and 1 second
...@@ -44,7 +44,7 @@ rack_test: ...@@ -44,7 +44,7 @@ rack_test:
stage: testing stage: testing
image: ruby:2.4-alpine image: ruby:2.4-alpine
script: script:
- gem install rack-test --no-ri --no-rdoc - gem install simplecov rack-test --no-ri --no-rdoc
- bundle install - bundle install
- touch .current - touch .current
- ruby test.rb - ruby test.rb
......
# frozen_string_literal: true
require 'yaml' require 'yaml'
config = { config = {
......
...@@ -102,7 +102,9 @@ describe 'Check username' do ...@@ -102,7 +102,9 @@ describe 'Check username' do
follow_redirect! follow_redirect!
last_request.url.must_include 'error' last_request.url.must_include 'error'
end end
end
describe 'Check full set' do
it 'should accept valid usernames, email and reason' do it 'should accept valid usernames, email and reason' do
post '/check-details', post '/check-details',
input_username: 'username', input_username: 'username',
...@@ -123,6 +125,26 @@ describe 'Check reason' do ...@@ -123,6 +125,26 @@ describe 'Check reason' do
end end
end end
describe 'Check email address' do
it 'should reject invalid email addresses' do
post '/check-details',
input_username: 'username',
input_email: 'not really an email.address',
input_reason: 'My reasons are my own.'
follow_redirect!
last_request.url.must_include 'error'
end
it 'should accept valid email addresses' do
post '/check-details',
input_username: 'username',
input_email: 'username@example.com',
input_reason: 'My reasons are my own.'
follow_redirect!
last_request.url.must_include 'not-yet-implemented'
end
end
describe 'Check phonenumber' do describe 'Check phonenumber' do
it 'should reject invalid phone numbers' do it 'should reject invalid phone numbers' do
post '/check-details', post '/check-details',
...@@ -143,6 +165,6 @@ describe 'Check phonenumber' do ...@@ -143,6 +165,6 @@ describe 'Check phonenumber' do
follow_redirect! follow_redirect!
last_request.url.must_include 'not-yet-implemented' last_request.url.must_include 'not-yet-implemented'
end end
# TODO: checks for error and warning pages
end end
# TODO: checks for error and warning pages
# frozen_string_literal: true # frozen_string_literal: true
ENV['RACK_ENV'] = 'test' ENV['RACK_ENV'] = 'test'
require 'simplecov'
require 'minitest/autorun' require 'minitest/autorun'
require 'rack/test' require 'rack/test'
SimpleCov.start
require File.expand_path '../signup_site.rb', __FILE__ require File.expand_path '../signup_site.rb', __FILE__
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment