File: memory_spec.rb

package info (click to toggle)
ruby-json-spec 1.1.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 312 kB
  • sloc: ruby: 1,059; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 702 bytes parent folder | download | duplicates (4)
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
require "spec_helper"

describe JsonSpec::Memory do
  it "has a memory" do
    JsonSpec.memory.should == {}
  end

  it "memorizes strings" do
    JsonSpec.memorize(:key, "value")
    JsonSpec.memory.should == { key: "value" }
  end

  it "symbolizes keys" do
    JsonSpec.memorize("key", "value")
    JsonSpec.memory.should == { key: "value" }
  end

  it "regurgitates unremembered strings" do
    JsonSpec.remember("foo%{bar}").should == "foo%{bar}"
  end

  it "remembers strings" do
    JsonSpec.memorize(:bar, "baz")
    JsonSpec.remember("foo%{bar}").should == "foobaz"
  end

  it "forgets" do
    JsonSpec.memorize(:key, "value")
    JsonSpec.forget
    JsonSpec.memory.should == {}
  end
end