MacSpec 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/MacSpec.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{MacSpec}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matthias Hennemeyer"]
data/README.rdoc CHANGED
@@ -13,8 +13,49 @@ Even a mocking framework is built in.
13
13
 
14
14
  == Install
15
15
 
16
+
16
17
  $sudo macgem install MacSpec
17
18
 
19
+ == Use
20
+
21
+
22
+ For Starters:
23
+ Create a brandnew MacRuby Application with the Xcode template that ships with MacRuby.
24
+ (Btw Have you installed MacRuby-0.5 already? http://www.macruby.org/downloads.html )
25
+
26
+ Open the stub_test.rb file that is located inside the Tests group and
27
+ replace the content with:
28
+
29
+ require "rubygems"
30
+ require "MacSpec"
31
+
32
+ describe "MacSpec TestCase" do
33
+ before do
34
+ # This gets executed before each test. (Like setup)
35
+ # Instance variables that are declared
36
+ # inside this block will be handed down to all
37
+ # tests.
38
+ @obj = Object.new
39
+ end
40
+
41
+ after do
42
+ # you guess it!
43
+ end
44
+
45
+ it "should work!" do
46
+ # this is the body of a test
47
+ @obj.should_receive(:hello).with("object").and_return("Hello MacSpec")
48
+ @obj.hello("object").should == "Hello MacSpec"
49
+ end
50
+
51
+ describe "Nested TestCase" do
52
+ it "has access to the stuff that has been defined in the outer before blocks" do
53
+ @obj.stub!(:some_method)
54
+ lambda {@obj.some_method}.should_not raise_error
55
+ end
56
+ end
57
+ end
58
+
18
59
 
19
60
 
20
61
  == Philosophy
@@ -30,6 +30,7 @@ module MacSpec
30
30
  end
31
31
 
32
32
  def stub!(hash)
33
+ hash = {hash => nil} unless Hash === hash
33
34
  @__macspec__message_expectations ||= []
34
35
  hash.each do |meth_to_stub, ret_val|
35
36
  options = {
@@ -1,3 +1,3 @@
1
1
  module MacSpec
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -15,5 +15,12 @@ describe "Stubs" do
15
15
  end
16
16
  end
17
17
  end
18
+
19
+ it "stub!(:meth)" do
20
+ obj = Object.new
21
+ obj.stub!(:meth)
22
+ lambda {obj.meth}.should_not raise_error
23
+ end
24
+
18
25
  end
19
26
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 2
9
- version: 0.3.2
8
+ - 3
9
+ version: 0.3.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matthias Hennemeyer