em-dextras 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,8 @@
1
1
  module EMDextras::Spec
2
2
  class Spy
3
- def initialize
3
+ def initialize(options = {})
4
4
  @calls = []
5
+ @return_value = options[:default_return]
5
6
  end
6
7
 
7
8
  def called?(method_name, *args)
@@ -16,6 +17,7 @@ module EMDextras::Spec
16
17
 
17
18
  def method_missing(method_name, *args, &block)
18
19
  @calls << { :name => method_name, :args => args }
20
+ @return_value
19
21
  end
20
22
 
21
23
  private
@@ -1,5 +1,5 @@
1
1
  module Em
2
2
  module Dextras
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -12,6 +12,17 @@ describe EMDextras::Spec::Spy do
12
12
  end
13
13
  end
14
14
 
15
+ describe "default return value" do
16
+ it "returns nil if no default return value is defined" do
17
+ spy = EMDextras::Spec::Spy.new
18
+ spy.some_method.should == nil
19
+ end
20
+
21
+ it "returns the default value if defined" do
22
+ spy = EMDextras::Spec::Spy.new :default_return => "default"
23
+ spy.some_method.should == "default"
24
+ end
25
+ end
15
26
  describe :received_call! do
16
27
  it "should do nothing if the call was really received" do
17
28
  EM.run do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-dextras
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-27 00:00:00.000000000 Z
12
+ date: 2013-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: eventmachine