File: asserts_topic_test.rb

package info (click to toggle)
ruby-riot 0.12.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 512 kB
  • sloc: ruby: 2,557; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,347 bytes parent folder | download | duplicates (2)
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
require 'teststrap'

context "The asserts_topic shortcut" do
  setup do
    Riot::Context.new("foo") {}.asserts_topic
  end

  should("return an Assertion") { topic }.kind_of(Riot::Assertion)

  should("return the actual topic as the result of evaling the assertion") do
    (situation = Riot::Situation.new).instance_variable_set(:@_topic, "bar")
    topic.equals("bar").run(situation)
  end.equals([:pass, %Q{is equal to "bar"}])

  asserts(:to_s).equals("asserts that it")

  context "with an explicit description" do
    setup { Riot::Context.new("foo") {}.asserts_topic("get some") }
    asserts(:to_s).equals("asserts get some")
  end
end # The asserts_topic shortcut

context "The denies_topic shortcut" do
  setup do
    Riot::Context.new("foo") {}.denies_topic
  end

  should("return an Assertion") { topic }.kind_of(Riot::Assertion)

  should("return the actual topic as the result of evaling the assertion") do
    (situation = Riot::Situation.new).instance_variable_set(:@_topic, "bar")
    topic.equals("not bar").run(situation)
  end.equals([:pass, %Q{is equal to "not bar" when it is "bar"}])

  asserts(:to_s).equals("denies that it")

  context "with an explicit description" do
    setup { Riot::Context.new("foo") {}.denies_topic("get some") }
    asserts(:to_s).equals("denies get some")
  end
end # The denies_topic shortcut