factis 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/README.md +1 -0
- data/lib/factis.rb +2 -2
- data/lib/factis/memory.rb +1 -3
- data/lib/factis/version.rb +1 -1
- data/spec/factis/memory_spec.rb +22 -24
- data/spec/factis_spec.rb +7 -7
- metadata +1 -2
- data/Gemfile.lock +0 -38
data/.gitignore
CHANGED
data/README.md
CHANGED
data/lib/factis.rb
CHANGED
data/lib/factis/memory.rb
CHANGED
data/lib/factis/version.rb
CHANGED
data/spec/factis/memory_spec.rb
CHANGED
@@ -13,73 +13,71 @@ describe Factis::Memory do
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
memory.all_facts[fact].should == content
|
22
|
-
end
|
16
|
+
describe %{.memorize} do
|
17
|
+
it %{records a fact when given a name and some content} do
|
18
|
+
memory.memorize(fact, content)
|
19
|
+
memory.all_facts.keys.include?(fact).should be_true
|
20
|
+
memory.all_facts[fact].should == content
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
26
|
-
describe
|
24
|
+
describe %{.known_fact?} do
|
27
25
|
before(:each) do
|
28
|
-
memory.
|
26
|
+
memory.memorize(fact, content)
|
29
27
|
end
|
30
28
|
|
31
|
-
it
|
29
|
+
it %{returns true for known facts} do
|
32
30
|
memory.known_fact?(fact).should be_true
|
33
31
|
end
|
34
32
|
|
35
|
-
it
|
33
|
+
it %{returns false for unknown facts} do
|
36
34
|
memory.known_fact?(:unknown).should be_false
|
37
35
|
end
|
38
36
|
end
|
39
37
|
|
40
|
-
describe
|
38
|
+
describe %{.forget} do
|
41
39
|
before(:each) do
|
42
|
-
memory.
|
40
|
+
memory.memorize(fact, content)
|
43
41
|
end
|
44
42
|
|
45
43
|
|
46
44
|
|
47
|
-
it
|
45
|
+
it %{removes a known fact from memory} do
|
48
46
|
memory.forget(fact)
|
49
47
|
memory.known_fact?(fact).should be_false
|
50
48
|
end
|
51
49
|
|
52
|
-
it
|
50
|
+
it %{raises an error when given an unknown fact} do
|
53
51
|
lambda {memory.forget("unknown fact")}.should raise_error
|
54
52
|
end
|
55
53
|
end
|
56
54
|
|
57
|
-
describe
|
55
|
+
describe %{.recall} do
|
58
56
|
before(:each) do
|
59
|
-
memory.
|
57
|
+
memory.memorize(fact, content)
|
60
58
|
end
|
61
59
|
|
62
|
-
it
|
60
|
+
it %{returns the content of a known fact} do
|
63
61
|
memory.recall(fact).should == content
|
64
62
|
end
|
65
63
|
|
66
|
-
it
|
64
|
+
it %{raises an error when given an unknown fact} do
|
67
65
|
lambda {memory.recall(:unknown)}.should raise_error
|
68
66
|
end
|
69
67
|
|
70
68
|
end
|
71
69
|
|
72
|
-
describe
|
73
|
-
it
|
70
|
+
describe %{.init_memory!} do
|
71
|
+
it %{should instantiate a new Hash for the memory} do
|
74
72
|
old = memory.all_facts.__id__
|
75
73
|
memory.init_memory!
|
76
74
|
memory.all_facts.__id__.should_not == old
|
77
75
|
end
|
78
76
|
end
|
79
77
|
|
80
|
-
describe
|
81
|
-
it
|
82
|
-
memory.
|
78
|
+
describe %{.reset!} do
|
79
|
+
it %{should clear the memory} do
|
80
|
+
memory.memorize(fact, content)
|
83
81
|
memory.known_fact?(fact).should be_true
|
84
82
|
memory.reset!
|
85
83
|
memory.known_fact?(fact).should be_false
|
data/spec/factis_spec.rb
CHANGED
@@ -22,15 +22,15 @@ describe Factis do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe %{
|
25
|
+
describe %{#memorize_fact} do
|
26
26
|
it %{stores the provided fact} do
|
27
|
-
Factis::Memory.should_receive(:
|
28
|
-
factis.
|
27
|
+
Factis::Memory.should_receive(:memorize).with(fact, content).and_call_original
|
28
|
+
factis.memorize_fact(fact, content)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
describe %{recall_fact} do
|
33
|
-
before(:each) {factis.
|
32
|
+
describe %{#recall_fact} do
|
33
|
+
before(:each) {factis.memorize_fact(fact, content)}
|
34
34
|
|
35
35
|
it %{recalls the provided fact if known} do
|
36
36
|
Factis::Memory.should_receive(:recall).with(fact).and_call_original
|
@@ -42,8 +42,8 @@ describe Factis do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
describe %{forget_fact} do
|
46
|
-
before(:each) {factis.
|
45
|
+
describe %{#forget_fact} do
|
46
|
+
before(:each) {factis.memorize_fact(fact, content)}
|
47
47
|
|
48
48
|
it %{forgets the provided fact if known} do
|
49
49
|
Factis::Memory.should_receive(:forget).with(fact).and_call_original
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -39,7 +39,6 @@ files:
|
|
39
39
|
- .ruby-gemset
|
40
40
|
- .ruby-version
|
41
41
|
- Gemfile
|
42
|
-
- Gemfile.lock
|
43
42
|
- LICENSE
|
44
43
|
- README.md
|
45
44
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
factis (0.0.0)
|
5
|
-
awesome_print
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
awesome_print (1.2.0)
|
11
|
-
builder (3.2.2)
|
12
|
-
cucumber (1.3.8)
|
13
|
-
builder (>= 2.1.2)
|
14
|
-
diff-lcs (>= 1.1.3)
|
15
|
-
gherkin (~> 2.12.1)
|
16
|
-
multi_json (>= 1.7.5, < 2.0)
|
17
|
-
multi_test (>= 0.0.2)
|
18
|
-
diff-lcs (1.2.4)
|
19
|
-
gherkin (2.12.1)
|
20
|
-
multi_json (~> 1.3)
|
21
|
-
multi_json (1.8.0)
|
22
|
-
multi_test (0.0.2)
|
23
|
-
rspec (2.14.1)
|
24
|
-
rspec-core (~> 2.14.0)
|
25
|
-
rspec-expectations (~> 2.14.0)
|
26
|
-
rspec-mocks (~> 2.14.0)
|
27
|
-
rspec-core (2.14.5)
|
28
|
-
rspec-expectations (2.14.3)
|
29
|
-
diff-lcs (>= 1.1.3, < 2.0)
|
30
|
-
rspec-mocks (2.14.3)
|
31
|
-
|
32
|
-
PLATFORMS
|
33
|
-
ruby
|
34
|
-
|
35
|
-
DEPENDENCIES
|
36
|
-
cucumber
|
37
|
-
factis!
|
38
|
-
rspec
|