factis 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ M2RiMDNlZTE0MTc4ZTQwMzE1NWJjM2YzNzMxMDJmNWJhMjJlZmU2Zg==
5
+ data.tar.gz: !binary |-
6
+ YTNhN2Y2MjgxMGViYWQ0YjE2ZjlhMTZiODRhNDVhZDU5YWQ2OGI5MQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NGU1YTRlNmVjZTJjNzZmZDE4YzhlZGJlMTEyYjIxZWI1NGQyYWQ2YjExYjBi
10
+ MmFjZDMyYTgzYTFlY2RlNDA4OWJlYzMwOTQ0OTNmNzA5MTM1MjVhNzQ4ODEy
11
+ ZDdkMjM0Y2RlOTZiMmFmYjZhNTU5MzQ4Mzg1YTU2NjU2OGVlNjY=
12
+ data.tar.gz: !binary |-
13
+ MjdkOTE5NmE2YWZiNWY5MzIwNDQyOWQ3NTBiY2RkMjAzMGRhZThmNTA1NDE2
14
+ OTNhM2Y3NWZhYTVmMDQ3ODk0ZmRjNjBlZjg5NWU0YTRhMzNmZTE1YWEwNjg5
15
+ MTczYzA4OWQxMGI3ZDljMjY3NzUzNTk4MzBhN2Y2MGVmMTY4MjM=
@@ -3,11 +3,18 @@ module Factis
3
3
  # facts.
4
4
  class Memory
5
5
 
6
+
6
7
  class << self
7
8
  private
8
9
  def init_memory!
9
10
  @facts ||= Hash.new
10
11
  end
12
+
13
+ def detect_unknown_fact(fact, error_message)
14
+ unless known_fact?(fact)
15
+ raise "#{error_message}: #{fact}"
16
+ end
17
+ end
11
18
  end
12
19
 
13
20
  # Get the entire facts hash
@@ -62,9 +69,7 @@ module Factis
62
69
 
63
70
  def self.forget(fact)
64
71
  init_memory!
65
- unless known_fact?(fact)
66
- raise %{Trying to forget an unknown fact: '#{fact}'}
67
- end
72
+ detect_unknown_fact(fact, 'Trying to forget an unknown fact')
68
73
  @facts.delete(fact)
69
74
  end
70
75
 
@@ -78,9 +83,7 @@ module Factis
78
83
 
79
84
  def self.recall(fact)
80
85
  init_memory!
81
- unless known_fact?(fact)
82
- raise %{Trying to recall an unknown fact: '#{fact}'}
83
- end
86
+ detect_unknown_fact(fact, 'Trying to recall an unknown fact')
84
87
  @facts[fact]
85
88
  end
86
89
 
@@ -3,7 +3,6 @@ require 'factis'
3
3
  RSpec.configure do |config|
4
4
  config.include Factis
5
5
  config.after(:each) do
6
- puts "let's clear the facts!"
7
6
  clear_all_facts!
8
7
  end
9
8
  end
@@ -1,3 +1,3 @@
1
1
  module Factis
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Dennis Walters
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-10-12 00:00:00.000000000 Z
11
+ date: 2013-12-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -59,27 +56,26 @@ files:
59
56
  homepage: http://github.com/elevatorup/factis
60
57
  licenses:
61
58
  - MIT
59
+ metadata: {}
62
60
  post_install_message:
63
61
  rdoc_options: []
64
62
  require_paths:
65
63
  - lib
66
64
  required_ruby_version: !ruby/object:Gem::Requirement
67
- none: false
68
65
  requirements:
69
66
  - - ! '>='
70
67
  - !ruby/object:Gem::Version
71
68
  version: '0'
72
69
  required_rubygems_version: !ruby/object:Gem::Requirement
73
- none: false
74
70
  requirements:
75
71
  - - ! '>='
76
72
  - !ruby/object:Gem::Version
77
73
  version: '0'
78
74
  requirements: []
79
75
  rubyforge_project:
80
- rubygems_version: 1.8.25
76
+ rubygems_version: 2.1.11
81
77
  signing_key:
82
- specification_version: 3
78
+ specification_version: 4
83
79
  summary: Discretely remember and recall facts in your tests
84
80
  test_files:
85
81
  - spec/factis/memory_spec.rb