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:
stage: testing
image: ruby:2.4-alpine
script:
- gem install rack-test --no-ri --no-rdoc
- gem install simplecov rack-test --no-ri --no-rdoc
- bundle install
- touch .current
- ruby test.rb
......
# frozen_string_literal: true
require 'yaml'
config = {
......
......@@ -102,7 +102,9 @@ describe 'Check username' do
follow_redirect!
last_request.url.must_include 'error'
end
end
describe 'Check full set' do
it 'should accept valid usernames, email and reason' do
post '/check-details',
input_username: 'username',
......@@ -123,6 +125,26 @@ describe 'Check reason' do
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
it 'should reject invalid phone numbers' do
post '/check-details',
......@@ -143,6 +165,6 @@ describe 'Check phonenumber' do
follow_redirect!
last_request.url.must_include 'not-yet-implemented'
end
# TODO: checks for error and warning pages
end
# TODO: checks for error and warning pages
# frozen_string_literal: true
ENV['RACK_ENV'] = 'test'
require 'simplecov'
require 'minitest/autorun'
require 'rack/test'
SimpleCov.start
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