riot 0.9.9 → 0.9.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.9
1
+ 0.9.10
@@ -36,9 +36,11 @@ module Riot
36
36
  def raises(expected, expected_message=nil)
37
37
  actual_error = raised.original_exception
38
38
  @raised = nil
39
- return fail("should have raised #{expected}, but raised nothing") unless actual_error
40
- return fail("should have raised #{expected}, not #{error.class}") unless expected == actual_error.class
41
- if expected_message && !(actual_error.message.to_s =~ %r[#{expected_message}])
39
+ if actual_error.nil?
40
+ return fail("should have raised #{expected}, but raised nothing")
41
+ elsif expected != actual_error.class
42
+ return fail("should have raised #{expected}, not #{actual_error.class}")
43
+ elsif expected_message && !(actual_error.message.to_s =~ %r[#{expected_message}])
42
44
  return fail("expected #{expected_message} for message, not #{actual_error.message}")
43
45
  end
44
46
  true
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{riot}
8
- s.version = "0.9.9"
8
+ s.version = "0.9.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin 'Gus' Knowlden"]
@@ -1,10 +1,16 @@
1
1
  require 'teststrap'
2
2
 
3
+ class MyException < Exception; end
4
+
3
5
  context "raises assertion:" do
4
6
  setup { Riot::Situation.new }
5
7
 
6
8
  should("raise an Exception") { raise Exception }.raises(Exception)
7
9
 
10
+ should "fail if Exception classes do not match" do
11
+ Riot::Assertion.new("foo", topic) { raise MyException }.raises(Exception)
12
+ end.kind_of(Riot::Failure)
13
+
8
14
  should "pass if provided message equals expectation" do
9
15
  Riot::Assertion.new("foo", topic) { raise Exception, "I'm a nerd" }.raises(Exception, "I'm a nerd")
10
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin 'Gus' Knowlden