factis 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,3 +3,6 @@
3
3
  /tmp
4
4
  *~
5
5
  *.swp
6
+ /pkg
7
+ /bin
8
+ Gemfile.lock
data/README.md CHANGED
@@ -66,6 +66,7 @@ recall_fact("What does Joe love?")
66
66
  # Just to make sure it's really forgotten ...
67
67
  forget_fact("What does Joe love?")
68
68
  => Trying to forget an unknown fact: 'What does Joe love?' (RuntimeError)
69
+
69
70
  # Let's just forget everything.
70
71
  clear_all_facts!
71
72
 
data/lib/factis.rb CHANGED
@@ -10,8 +10,8 @@ module Factis
10
10
  Factis::Memory.all_facts
11
11
  end
12
12
 
13
- def remember_fact(fact, content)
14
- Factis::Memory.remember(fact, content)
13
+ def memorize_fact(fact, content)
14
+ Factis::Memory.memorize(fact, content)
15
15
  end
16
16
 
17
17
  def recall_fact(fact)
data/lib/factis/memory.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'awesome_print'
2
-
3
1
  module Factis
4
2
  class Memory
5
3
 
@@ -12,7 +10,7 @@ module Factis
12
10
  @facts
13
11
  end
14
12
 
15
- def self.remember(fact, content)
13
+ def self.memorize(fact, content)
16
14
  init_memory! if @facts.nil?
17
15
  @facts[fact] = content
18
16
  end
@@ -1,3 +1,3 @@
1
1
  module Factis
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -13,73 +13,71 @@ describe Factis::Memory do
13
13
  end
14
14
  end
15
15
 
16
- describe '.remember' do
17
- context "when given a fact name and content" do
18
- it "records the fact" do
19
- memory.remember(fact, content)
20
- memory.all_facts.keys.include?(fact).should be_true
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 '.known_fact?' do
24
+ describe %{.known_fact?} do
27
25
  before(:each) do
28
- memory.remember(fact, content)
26
+ memory.memorize(fact, content)
29
27
  end
30
28
 
31
- it "returns true for known facts" do
29
+ it %{returns true for known facts} do
32
30
  memory.known_fact?(fact).should be_true
33
31
  end
34
32
 
35
- it "returns false for unknown facts" do
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 '.forget' do
38
+ describe %{.forget} do
41
39
  before(:each) do
42
- memory.remember(fact, content)
40
+ memory.memorize(fact, content)
43
41
  end
44
42
 
45
43
 
46
44
 
47
- it "removes a known fact from memory" do
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 "raises an error when given an unknown fact" do
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 '.recall' do
55
+ describe %{.recall} do
58
56
  before(:each) do
59
- memory.remember(fact, content)
57
+ memory.memorize(fact, content)
60
58
  end
61
59
 
62
- it "returns the content of a known fact" do
60
+ it %{returns the content of a known fact} do
63
61
  memory.recall(fact).should == content
64
62
  end
65
63
 
66
- it "raises an error when given an unknown fact" do
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 '.init_memory!' do
73
- it 'should instantiate a new Hash for the memory' do
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 '.reset!' do
81
- it 'should clear the memory' do
82
- memory.remember(fact, content)
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 %{remember_fact} do
25
+ describe %{#memorize_fact} do
26
26
  it %{stores the provided fact} do
27
- Factis::Memory.should_receive(:remember).with(fact, content).and_call_original
28
- factis.remember_fact(fact, content)
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.remember_fact(fact, content)}
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.remember_fact(fact, content)}
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.3
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