stendhal 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stendhal (0.0.1)
4
+ stendhal (0.1.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/Readme.md CHANGED
@@ -6,24 +6,50 @@ Currently under development, there is only basic functionality for now.
6
6
  Below I will be posting whatever features are available throughout the
7
7
  development.
8
8
 
9
+ ##Current features
10
+
11
+ * Nested example groups
12
+ * Pending examples
13
+ * Lame reporter (but will get better eventually)
14
+ * Matchers (use with object.must or object.must_not)
15
+ eq() / eql()
16
+ be_a() / be_kind_of() / be_a_kind_of()
17
+ be_whatever # asks object.whatever?
18
+
19
+
9
20
  ##Installation
10
21
 
11
22
  gem install stendhal
12
23
 
13
24
  ##Usage
14
25
 
15
- # your spec file for some class - my_class_spec.rb
26
+ # your spec file for some class - foo_spec.rb
16
27
 
17
- describe "My fancy class" do
28
+ describe "Foo" do
18
29
 
19
30
  it "does something" do
20
31
  my_object = MyClass.new
21
- my_object.fancy = true
32
+ my_object.must be_a(MyClass)
33
+ end
22
34
 
23
- assert my_object.fancy
35
+
36
+ it "fails when 7 is not 9" do
37
+ (3 + 4).must eq(9)
24
38
  end
25
39
 
26
- describe "Additional functionality" do
40
+ it "asks for a kind of object" do
41
+ "string".must be_a(String)
42
+ end
43
+
44
+ it "asks things to objects" do
45
+ "string".must be_frozen
46
+ end
47
+
48
+ it "has common sense" do
49
+ "string".must_not eq(3)
50
+ end
51
+
52
+ describe "Pending examples" do
27
53
 
28
54
  it "should do something but I don't know what yet"
29
55
 
@@ -38,18 +64,24 @@ development.
38
64
 
39
65
  ###Running the specs!
40
66
 
41
- stendhal my_class_spec.rb
67
+ stendhal foo_spec.rb
42
68
 
43
69
  ###And the output...
44
70
 
45
- My fancy class
71
+ Foo
46
72
  * does something
47
-
48
- Additional functionality
73
+ * fails when 7 is not 9 [FAILED]
74
+ expected 7 to equal 9
75
+ * asks for a kind of object
76
+ * asks things to objects [FAILED]
77
+ expected "string" to be frozen
78
+ * has common sense
79
+
80
+ Pending examples
49
81
  * should do something but I don't know what yet
50
82
  * will do something else
51
83
 
52
- 3 examples, 0 failures, 2 pending
84
+ 7 examples, 2 failures, 2 pending
53
85
 
54
86
  ##Note on Patches/Pull Requests
55
87
 
@@ -1,15 +1,15 @@
1
1
  Feature: Examples and example groups
2
2
 
3
- Spec-ish Domain Specific Language
3
+ RSpec-ish Domain Specific Language
4
4
 
5
5
  Scenario: declare an example
6
- Given a directory named "rspec_project"
7
- When I cd to "rspec_project"
6
+ Given a directory named "stendhal_project"
7
+ When I cd to "stendhal_project"
8
8
  Given a file named "sample_spec.rb" with:
9
9
  """
10
10
  describe "something" do
11
11
  it "does something" do
12
- assert true
12
+ # put your code here
13
13
  end
14
14
  end
15
15
  """
@@ -18,29 +18,30 @@ Feature: Examples and example groups
18
18
  And the output should contain "1 example, 0 failures"
19
19
 
20
20
  Scenario: declare a failing example
21
- Given a directory named "rspec_project"
22
- When I cd to "rspec_project"
21
+ Given a directory named "stendhal_project"
22
+ When I cd to "stendhal_project"
23
23
  Given a file named "sample_spec.rb" with:
24
24
  """
25
25
  describe "something" do
26
26
  it "does something" do
27
- assert false
27
+ fail "this is not what I expected"
28
28
  end
29
29
  end
30
30
  """
31
31
  When I run "stendhal sample_spec.rb"
32
32
  Then the exit status should be 0
33
- And the output should contain "* does something"
33
+ And the output should contain "* does something [FAILED]"
34
+ And the output should contain "this is not what I expected"
34
35
  And the output should contain "1 example, 1 failure"
35
36
 
36
37
  Scenario: declare a pending example
37
- Given a directory named "rspec_project"
38
- When I cd to "rspec_project"
38
+ Given a directory named "stendhal_project"
39
+ When I cd to "stendhal_project"
39
40
  Given a file named "sample_spec.rb" with:
40
41
  """
41
42
  describe "something" do
42
43
  pending "does something" do
43
- assert false
44
+ fail "this is not what I expected"
44
45
  end
45
46
  end
46
47
  """
@@ -50,14 +51,14 @@ Feature: Examples and example groups
50
51
  And the output should contain "1 example, 0 failures, 1 pending"
51
52
 
52
53
  Scenario: declare an example in nested groups
53
- Given a directory named "rspec_project"
54
- When I cd to "rspec_project"
54
+ Given a directory named "stendhal_project"
55
+ When I cd to "stendhal_project"
55
56
  Given a file named "sample_spec.rb" with:
56
57
  """
57
58
  describe "something" do
58
59
  describe "inside another thing" do
59
60
  it "does this" do
60
- assert true
61
+ # put your code here
61
62
  end
62
63
  end
63
64
  end
@@ -70,22 +71,22 @@ Feature: Examples and example groups
70
71
  And the output should contain "1 example, 0 failures"
71
72
 
72
73
  Scenario: many examples in different example groups
73
- Given a directory named "rspec_project"
74
- When I cd to "rspec_project"
74
+ Given a directory named "stendhal_project"
75
+ When I cd to "stendhal_project"
75
76
  Given a file named "sample_spec.rb" with:
76
77
  """
77
78
  describe "something" do
78
79
  describe "inside another thing" do
79
80
  it "does this" do
80
- assert true
81
+ # put your code here
81
82
  end
82
83
  end
83
84
  describe "pending" do
84
85
  pending "todo" do
85
- assert false
86
+ # put your code here
86
87
  end
87
88
  it "fails" do
88
- assert false
89
+ fail "indeed"
89
90
  end
90
91
  end
91
92
  end
@@ -97,5 +98,6 @@ Feature: Examples and example groups
97
98
  And the output should contain "* does this"
98
99
  And the output should contain "pending"
99
100
  And the output should contain "* todo"
100
- And the output should contain "* fails"
101
+ And the output should contain "* fails [FAILED]"
102
+ And the output should contain "indeed"
101
103
  And the output should contain "3 examples, 1 failure, 1 pending"
@@ -0,0 +1,119 @@
1
+ Feature: Expectations
2
+
3
+ Stendhal comes with some built-in expectations.
4
+
5
+ Scenario: equality expectations
6
+ Given a directory named "stendhal_project"
7
+ When I cd to "stendhal_project"
8
+ Given a file named "sample_spec.rb" with:
9
+ """
10
+ describe "something" do
11
+ it "does something" do
12
+
13
+ (3 + 4).must eq(7)
14
+ 6.must_not eql(7)
15
+
16
+ end
17
+ end
18
+ """
19
+ When I run "stendhal sample_spec.rb"
20
+ Then the exit status should be 0
21
+ And the output should contain "1 example, 0 failures"
22
+
23
+ Scenario: failed equality expectations
24
+ Given a directory named "stendhal_project"
25
+ When I cd to "stendhal_project"
26
+ Given a file named "sample_spec.rb" with:
27
+ """
28
+ describe "something" do
29
+ it "does something" do
30
+
31
+ (3 + 4).must eql(4)
32
+
33
+ end
34
+ it "does something else" do
35
+
36
+ 4.must_not eq(4)
37
+
38
+ end
39
+ end
40
+ """
41
+ When I run "stendhal sample_spec.rb"
42
+ Then the exit status should be 0
43
+ And the output should contain "expected 7 to equal 4"
44
+ And the output should contain "expected 4 to be different than 4"
45
+ And the output should contain "2 examples, 2 failures"
46
+
47
+ Scenario: kind_of expectations
48
+ Given a directory named "stendhal_project"
49
+ When I cd to "stendhal_project"
50
+ Given a file named "sample_spec.rb" with:
51
+ """
52
+ describe "something" do
53
+ it "does something" do
54
+
55
+ 6.must be_a(Fixnum)
56
+ 6.must be_kind_of(Fixnum)
57
+ 6.must be_kind_of(Fixnum)
58
+
59
+ end
60
+ end
61
+ """
62
+ When I run "stendhal sample_spec.rb"
63
+ Then the exit status should be 0
64
+ And the output should contain "1 example, 0 failures"
65
+
66
+ Scenario: failed kind_of expectations
67
+ Given a directory named "stendhal_project"
68
+ When I cd to "stendhal_project"
69
+ Given a file named "sample_spec.rb" with:
70
+ """
71
+ describe "something" do
72
+ it "does something" do
73
+
74
+ 6.must_not be_a(Fixnum)
75
+
76
+ end
77
+ end
78
+ """
79
+ When I run "stendhal sample_spec.rb"
80
+ Then the exit status should be 0
81
+ And the output should contain "expected 6 not to be a Fixnum"
82
+ And the output should contain "1 example, 1 failure"
83
+
84
+ Scenario: predicate expectations
85
+ Given a directory named "stendhal_project"
86
+ When I cd to "stendhal_project"
87
+ Given a file named "sample_spec.rb" with:
88
+ """
89
+ describe "something" do
90
+ it "does something" do
91
+
92
+ str = "String".freeze
93
+ str.must be_frozen
94
+
95
+ end
96
+ end
97
+ """
98
+ When I run "stendhal sample_spec.rb"
99
+ Then the exit status should be 0
100
+ And the output should contain "1 example, 0 failures"
101
+
102
+ Scenario: failed predicate expectations
103
+ Given a directory named "stendhal_project"
104
+ When I cd to "stendhal_project"
105
+ Given a file named "sample_spec.rb" with:
106
+ """
107
+ describe "something" do
108
+ it "does something" do
109
+
110
+ hash = {:number => 3}.freeze
111
+ hash.must_not be_frozen
112
+
113
+ end
114
+ end
115
+ """
116
+ When I run "stendhal sample_spec.rb"
117
+ Then the exit status should be 0
118
+ And the output should contain "expected {:number=>3} not to be frozen"
119
+ And the output should contain "1 example, 1 failure"
@@ -2,4 +2,10 @@ module Kernel
2
2
  def describe(*args,&blk)
3
3
  Stendhal::ExampleGroup.new(*args,&blk)
4
4
  end
5
+ def must(matcher)
6
+ matcher.match self
7
+ end
8
+ def must_not(matcher)
9
+ matcher.match self, :negative => true
10
+ end
5
11
  end
data/lib/stendhal/dsl.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module Stendhal
2
2
  module DSL
3
+
3
4
  module Example
4
5
  def it(*args,&blk)
5
6
  self.add_example Stendhal::Example.new(*args,&blk)
@@ -14,6 +15,7 @@ module Stendhal
14
15
  self.add_example Stendhal::Example.new(*args,options,&blk)
15
16
  end
16
17
  end
18
+
17
19
  end
18
20
  end
19
21
 
@@ -1,11 +1,12 @@
1
1
  module Stendhal
2
2
  class Example
3
- include Assertions
3
+ include Matchers
4
4
 
5
5
  @@examples = []
6
6
 
7
7
  attr_reader :description
8
8
  attr_reader :block
9
+ attr_reader :failed_message
9
10
 
10
11
  def initialize(docstring, options = {}, &block)
11
12
  @description = docstring
@@ -18,8 +19,9 @@ module Stendhal
18
19
  begin
19
20
  self.instance_eval(&@block)
20
21
  return 0
21
- rescue AssertionFailed=>e
22
+ rescue Exceptions::ExpectationNotMet=>e
22
23
  @failed = true
24
+ @failed_message = e.message
23
25
  return 1
24
26
  rescue StandardError=>e
25
27
  @aborted = true
@@ -43,6 +45,10 @@ module Stendhal
43
45
  @@examples.delete self
44
46
  end
45
47
 
48
+ def fail(message = 'failed')
49
+ raise Stendhal::Exceptions::ExpectationNotMet.new(message)
50
+ end
51
+
46
52
  class << self
47
53
 
48
54
  def destroy_all
@@ -26,7 +26,8 @@ module Stendhal
26
26
  end
27
27
  end.each do |example|
28
28
  failures += example.run
29
- $stdout.print "* #{example.description}\n"
29
+ $stdout.print "* #{example.description}#{' [FAILED]' if example.failed?}\n"
30
+ $stdout.print "\t#{example.failed_message}\n"
30
31
  end
31
32
  [examples.count, failures, pending]
32
33
  end
@@ -0,0 +1,5 @@
1
+ module Stendhal
2
+ module Exceptions
3
+ class ExpectationNotMet < StandardError; end
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ module Stendhal
2
+ module Matchers
3
+ class AbstractMatcher
4
+ attr_reader :target
5
+
6
+ def initialize(target)
7
+ @target = target
8
+ end
9
+
10
+ def match(original, options = {})
11
+ raise NotImplementedError
12
+ end
13
+
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ module Stendhal
2
+ module Matchers
3
+ class Equality < AbstractMatcher
4
+
5
+ def match(original, options = {})
6
+ message = "expected #{original.inspect} #{options[:negative] ? 'to be different than' : 'to equal'} #{@target.inspect}"
7
+ if options[:negative]
8
+ raise Stendhal::Exceptions::ExpectationNotMet.new(message) if @target == original
9
+ else
10
+ raise Stendhal::Exceptions::ExpectationNotMet.new(message) unless @target == original
11
+ end
12
+ true
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Stendhal
2
+ module Matchers
3
+ class Kind < AbstractMatcher
4
+
5
+ def match(original, options = {})
6
+ message = "expected #{original.inspect} #{options[:negative] ? 'not ' : ''}to be a #{@target.inspect}"
7
+ if options[:negative]
8
+ raise Stendhal::Exceptions::ExpectationNotMet.new(message) if original.is_a?(@target)
9
+ else
10
+ raise Stendhal::Exceptions::ExpectationNotMet.new(message) unless original.is_a?(@target)
11
+ end
12
+ true
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Stendhal
2
+ module Matchers
3
+ class Predicate < AbstractMatcher
4
+
5
+ def match(original, options = {})
6
+ message = "expected #{original.inspect} #{options[:negative] ? 'not ' : ''}to be #{@target.to_s.gsub('?','')}"
7
+ if options[:negative]
8
+ raise Stendhal::Exceptions::ExpectationNotMet.new(message) if original.send(@target)
9
+ else
10
+ raise Stendhal::Exceptions::ExpectationNotMet.new(message) unless original.send(@target)
11
+ end
12
+ true
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ require 'stendhal/matchers/abstract_matcher'
2
+ require 'stendhal/matchers/equality'
3
+ require 'stendhal/matchers/kind'
4
+ require 'stendhal/matchers/predicate'
5
+
6
+ module Stendhal
7
+ module Matchers
8
+ def eq(other)
9
+ Equality.new(other)
10
+ end
11
+ alias_method :eql, :eq
12
+
13
+ def be_a(kind)
14
+ Kind.new(kind)
15
+ end
16
+ alias_method :be_kind_of, :be_a
17
+ alias_method :be_a_kind_of, :be_a
18
+
19
+ def method_missing(m,*args)
20
+ if m.to_s =~ /be_(\w+)/
21
+ Predicate.new(($1 + '?').to_sym)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Stendhal
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/stendhal.rb CHANGED
@@ -1,4 +1,5 @@
1
- require 'stendhal/assertions'
1
+ require 'stendhal/exceptions'
2
+ require 'stendhal/matchers'
2
3
  require 'stendhal/example'
3
4
  require 'stendhal/example_group'
4
5
 
@@ -38,13 +38,13 @@ module Stendhal
38
38
  @group = ExampleGroup.new("group")
39
39
  4.times do
40
40
  example = Example.new("some example") do
41
- assert true
41
+ true
42
42
  end
43
43
  @runnable_examples << example
44
44
  @group.add_example example
45
45
  end
46
46
  @failing_example = Example.new("failing") do
47
- assert false
47
+ fail "this example fails just because"
48
48
  end
49
49
  @group.add_example @failing_example
50
50
  @pending_example = Example.new("pending")
@@ -32,13 +32,14 @@ module Stendhal
32
32
  example.run
33
33
  end
34
34
 
35
- it "captures failed assertions" do
35
+ it "captures unmet expectations" do
36
36
  example = Example.new("docstring") do
37
- assert false
37
+ raise Stendhal::Exceptions::ExpectationNotMet.new("expected this example to be awesome")
38
38
  end
39
39
  expect {example.run}.to_not raise_error
40
40
  example.run
41
41
  example.should be_failed
42
+ example.failed_message.should == "expected this example to be awesome"
42
43
  end
43
44
 
44
45
  it "captures exceptions" do
@@ -52,6 +53,17 @@ module Stendhal
52
53
 
53
54
  end
54
55
 
56
+ describe "#fail" do
57
+ it 'fails with a given message' do
58
+ example = Example.new("docstring") do
59
+ fail "expectation not awesome enough"
60
+ end
61
+ example.run
62
+ example.should be_failed
63
+ example.failed_message.should == "expectation not awesome enough"
64
+ end
65
+ end
66
+
55
67
  describe "class methods" do
56
68
  describe "#count" do
57
69
  it "returns the number of examples in memory" do
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ module Stendhal
4
+ module Matchers
5
+ describe AbstractMatcher do
6
+
7
+ it 'initializes with a target' do
8
+ matcher = AbstractMatcher.new("target")
9
+ matcher.target.should == "target"
10
+ end
11
+
12
+ it 'does not implement #match' do
13
+ matcher = AbstractMatcher.new("target")
14
+ expect { matcher.match("whatever") }.to raise_error(NotImplementedError)
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ module Stendhal
4
+ module Matchers
5
+ describe Equality do
6
+
7
+ describe "#match" do
8
+ it 'passes when original and target objects are equivalent' do
9
+ matcher = Equality.new("string")
10
+ matcher.match("string").should be_true
11
+ end
12
+
13
+ it 'fails when original and target objects are unequivalent' do
14
+ matcher = Equality.new("string")
15
+ expected_message = %q{expected "other string" to equal "string"}
16
+ expect {
17
+ matcher.match("other string")
18
+ }.to raise_error(Stendhal::Exceptions::ExpectationNotMet, expected_message)
19
+ end
20
+
21
+ context "with :negative => true" do
22
+
23
+ it 'passes when found unequivalence' do
24
+ matcher = Equality.new("string")
25
+ matcher.match("other string", :negative => true).should be_true
26
+ end
27
+
28
+ it 'fails otherwise' do
29
+ matcher = Equality.new("string")
30
+ expected_message = %q{expected "string" to be different than "string"}
31
+ expect {
32
+ matcher.match("string", :negative => true)
33
+ }.to raise_error(Stendhal::Exceptions::ExpectationNotMet, expected_message)
34
+ end
35
+
36
+ end
37
+ end
38
+
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ module Stendhal
4
+ module Matchers
5
+ describe Kind do
6
+
7
+ describe "#match" do
8
+ it 'passes when original is a subclass of target' do
9
+ matcher = Kind.new(Numeric)
10
+ matcher.match(3).should be_true
11
+ end
12
+
13
+ it 'fails otherwise' do
14
+ matcher = Kind.new(Fixnum)
15
+ expected_message = %q{expected 3.2 to be a Fixnum}
16
+ expect {
17
+ matcher.match(3.2)
18
+ }.to raise_error(Stendhal::Exceptions::ExpectationNotMet, expected_message)
19
+ end
20
+
21
+ context "with :negative => true" do
22
+
23
+ it 'passes when original is not a subclass of target' do
24
+ matcher = Kind.new(Numeric)
25
+ matcher.match("string", :negative => true).should be_true
26
+ end
27
+
28
+ it 'fails otherwise' do
29
+ matcher = Kind.new(Numeric)
30
+ expected_message = %q{expected 3 not to be a Numeric}
31
+ expect {
32
+ matcher.match(3, :negative => true)
33
+ }.to raise_error(Stendhal::Exceptions::ExpectationNotMet, expected_message)
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ module Stendhal
4
+ module Matchers
5
+ describe Predicate do
6
+
7
+ describe "#match" do
8
+ it 'passes when original responds to target returning true' do
9
+ matcher = Predicate.new(:frozen?)
10
+ matcher.match("string".freeze).should be_true
11
+ end
12
+
13
+ it 'fails when it returns false' do
14
+ matcher = Predicate.new(:frozen?)
15
+ expected_message = %q{expected "string" to be frozen}
16
+ expect {
17
+ matcher.match("string")
18
+ }.to raise_error(Stendhal::Exceptions::ExpectationNotMet, expected_message)
19
+ end
20
+
21
+ context "with :negative => true" do
22
+
23
+ it 'passes when original returns false when sent target' do
24
+ matcher = Predicate.new(:frozen?)
25
+ matcher.match("string", :negative => true).should be_true
26
+ end
27
+
28
+ it 'fails otherwise' do
29
+ matcher = Predicate.new(:frozen?)
30
+ expected_message = %q{expected "string" not to be frozen}
31
+ expect {
32
+ matcher.match("string".freeze, :negative => true)
33
+ }.to raise_error(Stendhal::Exceptions::ExpectationNotMet, expected_message)
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ class MyClass
4
+ include Stendhal::Matchers
5
+ end
6
+
7
+ module Stendhal
8
+ describe "a class with included Matchers" do
9
+
10
+ let(:object) { MyClass.new }
11
+
12
+ describe "#==" do
13
+ it 'creates a new equality expectation' do
14
+ Matchers::Equality.should_receive(:new).with(7)
15
+ object == 7
16
+ end
17
+ end
18
+
19
+ describe "#be_a" do
20
+ it 'creates a new kind expectation' do
21
+ Matchers::Kind.should_receive(:new).with(Fixnum)
22
+ object.be_a(Fixnum)
23
+ end
24
+ end
25
+
26
+ describe "#be_whatever" do
27
+ it 'creates a new predicate expectation' do
28
+ Matchers::Predicate.should_receive(:new).with(:frozen?)
29
+ object.be_frozen
30
+ end
31
+ end
32
+
33
+ end
34
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Josep M. Bach
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-29 00:00:00 +02:00
17
+ date: 2010-10-31 01:00:00 +02:00
18
18
  default_executable: stendhal
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -90,21 +90,31 @@ files:
90
90
  - Readme.md
91
91
  - bin/stendhal
92
92
  - features/examples.feature
93
+ - features/expectations.feature
93
94
  - features/support/env.rb
94
95
  - lib/stendhal.rb
95
- - lib/stendhal/assertions.rb
96
96
  - lib/stendhal/autorun.rb
97
97
  - lib/stendhal/core_ext/kernel.rb
98
98
  - lib/stendhal/dsl.rb
99
99
  - lib/stendhal/example.rb
100
100
  - lib/stendhal/example_group.rb
101
+ - lib/stendhal/exceptions.rb
102
+ - lib/stendhal/matchers.rb
103
+ - lib/stendhal/matchers/abstract_matcher.rb
104
+ - lib/stendhal/matchers/equality.rb
105
+ - lib/stendhal/matchers/kind.rb
106
+ - lib/stendhal/matchers/predicate.rb
101
107
  - lib/stendhal/version.rb
102
108
  - script/console
103
109
  - spec/spec_helper.rb
104
- - spec/stendhal/assertions_spec.rb
105
110
  - spec/stendhal/core_ext/kernel_spec.rb
106
111
  - spec/stendhal/example_group_spec.rb
107
112
  - spec/stendhal/example_spec.rb
113
+ - spec/stendhal/matchers/abstract_matcher_spec.rb
114
+ - spec/stendhal/matchers/equality_spec.rb
115
+ - spec/stendhal/matchers/kind_spec.rb
116
+ - spec/stendhal/matchers/predicate_spec.rb
117
+ - spec/stendhal/matchers_spec.rb
108
118
  - stendhal.gemspec
109
119
  has_rdoc: true
110
120
  homepage: http://rubygems.org/gems/stendhal
@@ -140,9 +150,14 @@ specification_version: 3
140
150
  summary: Stendhal is a really simple test framework.
141
151
  test_files:
142
152
  - features/examples.feature
153
+ - features/expectations.feature
143
154
  - features/support/env.rb
144
155
  - spec/spec_helper.rb
145
- - spec/stendhal/assertions_spec.rb
146
156
  - spec/stendhal/core_ext/kernel_spec.rb
147
157
  - spec/stendhal/example_group_spec.rb
148
158
  - spec/stendhal/example_spec.rb
159
+ - spec/stendhal/matchers/abstract_matcher_spec.rb
160
+ - spec/stendhal/matchers/equality_spec.rb
161
+ - spec/stendhal/matchers/kind_spec.rb
162
+ - spec/stendhal/matchers/predicate_spec.rb
163
+ - spec/stendhal/matchers_spec.rb
@@ -1,12 +0,0 @@
1
- module Stendhal
2
- module Assertions
3
- def assert test, msg = nil
4
- msg ||= "Failed assertion, no message given."
5
- unless test then
6
- raise AssertionFailed, msg
7
- end
8
- true
9
- end
10
- end
11
- class AssertionFailed < Exception; end
12
- end
@@ -1,29 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class MyClass
4
- include Stendhal::Assertions
5
- end
6
-
7
- module Stendhal
8
- describe Assertions do
9
-
10
- subject { MyClass.new }
11
-
12
- describe "#assert" do
13
-
14
- it "does nothing if asserted expression returns true" do
15
- subject.assert true
16
- end
17
-
18
- it "raises an AssertionFailed exception otherwise" do
19
- expect { subject.assert false }.to raise_error(AssertionFailed)
20
- end
21
-
22
- it "yields a given message for the error" do
23
- expect { subject.assert false, "softwared!" }.to raise_error(AssertionFailed, "softwared!")
24
- end
25
-
26
- end
27
-
28
- end
29
- end