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
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
|
data/lib/mac_spec/version.rb
CHANGED