]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/stories/resources/test/spec_and_test_together.rb
added RSpec and RSpec on Rails
[rails.git] / vendor / gems / rspec-1.1.2 / stories / resources / test / spec_and_test_together.rb
1 $:.push File.join(File.dirname(__FILE__), *%w[.. .. .. lib])
2 require 'spec'
3 # TODO - this should not be necessary, ay?
4 require 'spec/interop/test'
5
6 describe "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
22 end
23
24 class 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
57 end