test_simple 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dd9ba829a7cb1a18738cbc0ae6b9f9be86c1210a
4
+ data.tar.gz: 465ffdaf925c1ba2bb2a1be2c10713daf59ed3e7
5
+ SHA512:
6
+ metadata.gz: feff40ad3ada1a8cbe1352b18f4f19402ad10407bfc52581efb7a4ff6cad8b837d9e78e752e2f33a5df75d0141a5cbaaebe8f55a3770f740b63f757c63ec4a09
7
+ data.tar.gz: a95c2003a53640112d5c6643f974aa4242b88d6c4ad664d25a9f04bd37bef8767d1c7993d9300b8c950135a1e06c6131d47f7142c4918ed1ac2900baf8bccf0c
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in test_simple.gemspec
4
+ gemspec
@@ -0,0 +1,39 @@
1
+ # TestSimple
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/test_simple`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'test_simple'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install test_simple
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ 1. Fork it ( https://github.com/[my-github-username]/test_simple/fork )
36
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
37
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
38
+ 4. Push to the branch (`git push origin my-new-feature`)
39
+ 5. Create a new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "test_simple"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ require "test_simple/version"
2
+ require "test_simple/object"
3
+ require "colorize"
4
+
5
+
6
+ module TestSimple
7
+ end
@@ -0,0 +1,78 @@
1
+ require "colorize"
2
+
3
+ class Object
4
+ $assertions = 0
5
+ $failed = 0
6
+ $error = 0
7
+ $passed = 0
8
+ $no = 1
9
+ $msg = {}
10
+ $pp = {}
11
+
12
+ def pp(to_print)
13
+ $pp[$no] ||= []
14
+ $pp[$no] << to_print
15
+ $pp[$no] = $pp[$no].uniq
16
+ end
17
+
18
+ def setup
19
+ yield
20
+ end
21
+
22
+ def should(name = 'test')
23
+ space = 31 - name.length
24
+ raise FormulationError, 'Test name too long must be 30 char or less' if name.length > 50
25
+ begin
26
+ yield
27
+ if yield == false
28
+ raise Fail
29
+ end
30
+ print "passed".colorize(:green)
31
+ $passed += 1
32
+ rescue Fail => e
33
+ print "failed".colorize(:red)
34
+ $msg["#{$no}. #{name}"] = [e]
35
+ $failed += 1
36
+ rescue => exception
37
+ print "error ".colorize(:red)
38
+ $msg["#{$no}. #{name}"] = [exception] + exception.backtrace
39
+ $error += 1
40
+ end
41
+ print " #{$no}. #{name}"
42
+ puts ' '
43
+ $pp[$no].each { |pp| puts pp } if $pp[$no]
44
+ puts ' ' if $pp[$no]
45
+ $no += 1
46
+ end
47
+
48
+ def assert(actual, expect)
49
+ $assertions += 1
50
+ raise Fail, "compared: #{actual} == #{expect}" unless actual == expect
51
+ end
52
+
53
+ def assert_not(actual, expect)
54
+ $assertions += 1
55
+ raise Fail, "compared: #{actual} == #{expect}" unless actual != expect
56
+ end
57
+
58
+ def results
59
+ color = ($failed >= 1 or $error >= 1) ? :red : :green
60
+ puts ' '
61
+ puts "Failed: #{$failed}, Errors: #{$error}, Passed: #{$passed}, Total: #{$failed + $error + $passed}, Assertions: #{$assertions}".colorize(color)
62
+ puts ' '
63
+ unless $msg.empty?
64
+ puts 'FAILURES & ERRORS'
65
+ $msg.each do |name, msg|
66
+ puts "#{name}".colorize(:red)
67
+ msg.each do |er|
68
+ puts " #{er}"
69
+ end
70
+ puts ' '
71
+ end
72
+ end
73
+ puts ' '
74
+ end
75
+
76
+ class Fail < StandardError
77
+ end
78
+ end
@@ -0,0 +1,3 @@
1
+ module TestSimple
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'test_simple/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "test_simple"
8
+ spec.version = TestSimple::VERSION
9
+ spec.authors = ["Colin Walker"]
10
+ spec.email = ["cjwalker@sfu.ca"]
11
+
12
+ spec.summary = %q{Very simple testing gem.}
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
+ spec.bindir = "exe"
16
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.9"
20
+ spec.add_development_dependency "rake", "~> 10.0"
21
+ spec.add_dependency "colorize", "~> 0.7.7"
22
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: test_simple
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Colin Walker
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: colorize
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.7.7
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.7.7
55
+ description:
56
+ email:
57
+ - cjwalker@sfu.ca
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - lib/test_simple.rb
71
+ - lib/test_simple/object.rb
72
+ - lib/test_simple/version.rb
73
+ - test_simple.gemspec
74
+ homepage:
75
+ licenses: []
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.4.6
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Very simple testing gem.
97
+ test_files: []