changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/stories/resources/test/spec_and_test_together.rb

changeset 15: 64acf98d15f4
author: moriq@moriq.com
date: Mon Mar 10 10:12:58 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugins rspec
1$:.push File.join(File.dirname(__FILE__), *%w[.. .. .. lib])
2require 'spec'
3# TODO - this should not be necessary, ay?
4require 'spec/interop/test'
5
6describe "An Example" do
7 it "should pass with assert" do
8 assert true
9 end
10
11 it "should fail with assert" do
12 assert false
13 end
14
15 it "should pass with should" do
16 1.should == 1
17 end
18
19 it "should fail with should" do
20 1.should == 2
21 end
22end
23
24class ATest < Test::Unit::TestCase
25 def test_should_pass_with_assert
26 assert true
27 end
28
29 def test_should_fail_with_assert
30 assert false
31 end
32
33 def test_should_pass_with_should
34 1.should == 1
35 end
36
37 def test_should_fail_with_should
38 1.should == 2
39 end
40
41 def setup
42 @from_setup ||= 3
43 @from_setup += 1
44 end
45
46 def test_should_fail_with_setup_method_variable
47 @from_setup.should == 40
48 end
49
50 before do
51 @from_before = @from_setup + 1
52 end
53
54 def test_should_fail_with_before_block_variable
55 @from_before.should == 50
56 end
57end