File: setup.rb

package info (click to toggle)
ruby-cutest 1.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 176 kB
  • sloc: ruby: 376; makefile: 14
file content (29 lines) | stat: -rw-r--r-- 585 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
setup do
  {:a => 23, :b => 43}
end

test "should receive the result of the setup block as a parameter" do |params|
  assert params == {:a => 23, :b => 43}
end

test "if the params are modified..." do |params|
  params[:a] = nil
end

test "...it should preserve the original values from the setup" do |params|
  assert_equal 23, params[:a]
end

setup do
  "Hello world!"
end

test "only the most recently defined setup block is executed" do |value|
  assert "Hello world!" == value
end

scope do
  test "works inside scopes too" do |value|
    assert "Hello world!" == value
  end
end