machospec 0.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.
Files changed (3) hide show
  1. data/lib/machospec.rb +54 -0
  2. data/spec/machospec_spec.rb +25 -0
  3. metadata +47 -0
data/lib/machospec.rb ADDED
@@ -0,0 +1,54 @@
1
+ module Kernel
2
+ def describe(comment)
3
+ puts comment.red
4
+ if block_given?
5
+ yield
6
+ else
7
+ p "Missing block"
8
+ end
9
+ end
10
+
11
+ def it(comment)
12
+ if block_given?
13
+ begin
14
+ yield
15
+ puts comment.green
16
+ rescue => e
17
+ puts comment.red
18
+ puts e.to_s.red
19
+ end
20
+ else
21
+ puts "#{comment} pending"
22
+ end
23
+ end
24
+ end
25
+
26
+ class Object
27
+ def should_equal object
28
+ if(self != object)
29
+ raise "#{object} is not equal to #{self}"
30
+ end
31
+ end
32
+
33
+ def should_not_be_nil
34
+ if(self.nil?)
35
+ raise "#{self} was supposed to be nil"
36
+ end
37
+ end
38
+
39
+ def should_be_nil
40
+ unless(self.nil?)
41
+ raise "#{self} was not supposed to be nil"
42
+ end
43
+ end
44
+ end
45
+
46
+ class String
47
+ def red
48
+ "\e[31m#{self}\e[0m"
49
+ end
50
+
51
+ def green
52
+ "\033[32m#{self}\033[0m"
53
+ end
54
+ end
@@ -0,0 +1,25 @@
1
+ require_relative '../lib/machospec'
2
+
3
+ describe "Testing Framework" do
4
+ describe ".should_equal" do
5
+ it "don't raise an exception if its true" do
6
+ exception = nil
7
+ begin
8
+ 4.should_equal 4
9
+ rescue => e
10
+ exception = e
11
+ end
12
+ exception.should_be_nil
13
+ end
14
+
15
+ it "raises and exeption if its not true" do
16
+ exception = nil
17
+ begin
18
+ 4.should_equal 6
19
+ rescue => e
20
+ exception = e
21
+ end
22
+ exception.should_not_be_nil
23
+ end
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: machospec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jose Andres Alvarez Loaiciga
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-07 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Personal testing gem
15
+ email: alvarezloaiciga@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/machospec.rb
21
+ - spec/machospec_spec.rb
22
+ homepage: https://github.com/alvarezloaiciga/machospec
23
+ licenses: []
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 1.8.25
43
+ signing_key:
44
+ specification_version: 3
45
+ summary: Testing Gem
46
+ test_files:
47
+ - spec/machospec_spec.rb