Browse Source

rspec, Drone CI

master
Christian Aust 1 year ago
parent
commit
cb14c8cc8d
  1. 10
      .drone.yml
  2. 3
      .gitignore
  3. 3
      .rspec
  4. 3
      Gemfile
  5. 17
      Gemfile.lock
  6. 11
      README.md
  7. 5
      Rakefile
  8. 2
      lib/sanity.rb
  9. 5
      spec/sanity_spec.rb
  10. 14
      spec/spec_helper.rb

10
.drone.yml

@ -0,0 +1,10 @@
---
kind: pipeline
name: default
steps:
- name: test
image: ruby:2.6.6-alpine
commands:
- bundle install
- rake test

3
.gitignore

@ -1 +1,4 @@
/*.json
# rspec failure tracking
.rspec_status

3
.rspec

@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper

3
Gemfile

@ -5,3 +5,6 @@ source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'ssl-test'
gem 'rake', '~> 12.0'
gem 'rspec', '~> 3.0'

17
Gemfile.lock

@ -1,12 +1,29 @@
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.4.4)
rake (12.3.3)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.3)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
ssl-test (1.3.1)
PLATFORMS
ruby
DEPENDENCIES
rake (~> 12.0)
rspec (~> 3.0)
ssl-test
BUNDLED WITH

11
README.md

@ -0,0 +1,11 @@
# Sanity
> “Any daily work task that takes 5 minutes will cost over 20 hours a year, or over half of a work week. Even if it takes 20 hours to automate that daily 5 minute task, the automation will break even in a year.”
> -- Anthony J. Stieber, Breaking into Information Security
Taking care for a running online application requires repetitive, dull little tasks. Check the web server response. See if certificates will expire (or even worse: Already did.) Check the server time. It adds up for one application, and we certainly have more than one. **Sanity** runs sanity checks on targets you define. It's meant to be run by CI pipelines and the like, producing output like a unit test suite.
## Implemented checks
* Static web response sanity
* SSL sanity

5
Rakefile

@ -0,0 +1,5 @@
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :spec

2
lib/sanity.rb

@ -1,6 +1,8 @@
require 'string_ext'
module Sanity
VERSION = '0.1.0'
autoload :Assertions, 'sanity/assertions'
autoload :Runner, 'sanity/runner'
autoload :Suite, 'sanity/suite'

5
spec/sanity_spec.rb

@ -0,0 +1,5 @@
RSpec.describe Sanity do
it "has a version number" do
expect(Sanity::VERSION).not_to be nil
end
end

14
spec/spec_helper.rb

@ -0,0 +1,14 @@
require 'bundler/setup'
require 'sanity'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
Loading…
Cancel
Save