s_tester 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzRiZGI3MjdiMjRhYzNmNWY1ZjU0MGMxYjRhYTZkMjY1NmEwZGNjOQ==
5
+ data.tar.gz: !binary |-
6
+ YzE0NWVjMzZiZWM3ZWM0OTA2ZGVkZTNiMTdjZTE2ZGVlMjQyODFlNQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YWU5MmQxZjg3YzkwYTEyNmNhMGYyMjBhNGFlODNjNzQ1NWJjNmE0ZGM1Y2Y4
10
+ NjJmODhhOWNmMTA4YTU4MDRiMjQwNzU0OGRiOWRmYzgwOTUwMmE4Y2QzNzU1
11
+ ZDk0OGJmZmJhOWYxODUyYTkwMjA1NDMxZjIzMWFkNTA5OGRlOGY=
12
+ data.tar.gz: !binary |-
13
+ ODc0ZmE0Y2NlZDdhOGRkN2ExNjAxNWY5ZmJjYmE4N2U2Nzk0Yjg0NGJhNmVl
14
+ MDI1M2Q5MjVkNDFkYzJjOTFjZDQxNTc4NjdlZmY3MTBjNjk2YWRmM2JjMGYx
15
+ OTAyMGU0MWQzOWE0NTkzYjc0OTAwNWI2MjQzYzlmNDhhNzk2Y2M=
data/lib/evaluator.rb ADDED
@@ -0,0 +1,19 @@
1
+ require "s_tester_exception"
2
+ class Object
3
+
4
+ def be_equal value
5
+ return {:evaluator => :eq, :result_expected => value}
6
+ end
7
+
8
+ def should comparator
9
+ send comparator[:evaluator], comparator[:result_expected]
10
+ end
11
+
12
+ def method_missing sym, *args, &block
13
+ raise "Sorry we'll build it ASAP"
14
+ end
15
+
16
+ def eq result_expected
17
+ raise STesterException.new(self, "Equals", result_expected) unless self == result_expected
18
+ end
19
+ end
data/lib/painter.rb ADDED
@@ -0,0 +1,18 @@
1
+ class Painter
2
+
3
+ class << self
4
+
5
+ def correct text
6
+ print "\033[32m#{text}\033[0m"
7
+ end
8
+
9
+ def error text
10
+ print "\033[31m#{text}\033[0m"
11
+ end
12
+
13
+ def attention text
14
+ print "\033[33m#{text}\033[0m"
15
+ end
16
+
17
+ end
18
+ end
data/lib/s_tester.rb ADDED
@@ -0,0 +1,27 @@
1
+ require "evaluator"
2
+ require "painter"
3
+
4
+ class STester
5
+
6
+ class << self
7
+
8
+ def description text
9
+ p text
10
+ end
11
+
12
+ def context text
13
+ p text
14
+ end
15
+
16
+ def it text
17
+ begin
18
+ yield
19
+ Painter.correct text
20
+ rescue STesterException => e
21
+ Painter.error(text + e.message)
22
+ end
23
+ end
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,12 @@
1
+ class STesterException < Exception
2
+
3
+ attr_reader :value, :comparator, :expected_result
4
+
5
+ def initialize value, comparator, expected_result
6
+ @value, @comparator, @expected_result = value, comparator, expected_result
7
+ end
8
+
9
+ def message
10
+ "Sorry bro, #{value} is not #{comparator} to #{expected_result}. Fix it!"
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: s_tester
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Esteban Soto
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Testing framework gem
14
+ email: esoto@pernix.cr
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/s_tester.rb
20
+ - lib/evaluator.rb
21
+ - lib/painter.rb
22
+ - lib/s_tester_exception.rb
23
+ homepage: http://rubygems.org/gems/hola
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.1.9
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Testing framework
47
+ test_files: []