File: spec_new_style.rb

package info (click to toggle)
ruby-test-spec 0.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 280 kB
  • sloc: ruby: 1,851; makefile: 9
file content (80 lines) | stat: -rw-r--r-- 1,340 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
describe_shared "A new-style shared description" do
  it "should work as well with shared descriptions" do
    true.should.be true
  end
end

describe "A new-style description" do
  before do
    @before = true
    @a = 2
  end

  before(:each) do
    @before_each = true
  end

  before(:all) do
    $before_all = true
  end

  it "should run before-clauses" do
    $before_all.should.be true
    @before.should.be true
    @before_each.should.be true
  end

  it "should behave like context/specify" do
    (1+1).should.equal 2
  end

  xit "this is disabled" do
    bla
  end

  after do
    @a.should.equal 2
    @a = 3
  end

  after(:each) do
    @a.should.equal 3
  end

  after(:all) do
    @b = 1
  end

  after(:all) do
    @b.should.equal 1
  end

  $describescope = self
  it "should raise on unimplement{ed,able} before/after" do
    lambda {
      $describescope.before(:foo) {}
    }.should.raise(ArgumentError)
    lambda {
      $describescope.after(:foo) {}
    }.should.raise(ArgumentError)

    lambda {
      context "foo" do
      end
    }.should.raise(Test::Spec::DefinitionError)
  end

  describe "when nested" do
    it "should work" do
    end
  end

  behaves_like "A new-style shared description"
end

describe "An empty description" do
end

xdescribe "An disabled description" do
  it "should not be run"
end