Browse Source

rspec, Drone CI

master
Christian Aust 3 weeks ago
parent
commit
cb14c8cc8d
10 changed files with 73 additions and 0 deletions
  1. +10
    -0
      .drone.yml
  2. +3
    -0
      .gitignore
  3. +3
    -0
      .rspec
  4. +3
    -0
      Gemfile
  5. +17
    -0
      Gemfile.lock
  6. +11
    -0
      README.md
  7. +5
    -0
      Rakefile
  8. +2
    -0
      lib/sanity.rb
  9. +5
    -0
      spec/sanity_spec.rb
  10. +14
    -0
      spec/spec_helper.rb

+ 10
- 0
.drone.yml View File

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

+ 3
- 0
.gitignore View File

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

+ 3
- 0
.rspec View File

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

+ 3
- 0
Gemfile View File

@ -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
- 0
Gemfile.lock View File

@ -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
- 0
README.md View File

@ -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
- 0
Rakefile View File

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

+ 2
- 0
lib/sanity.rb View File

@ -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
- 0
spec/sanity_spec.rb View File

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

+ 14
- 0
spec/spec_helper.rb View File

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