fakes-rspec 1.0.2 → 1.0.3
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.
- metadata +9 -11
- data/lib/core/block_criteria.rb +0 -12
- data/lib/core/matcher.rb +0 -46
- data/lib/core/nullo_specification.rb +0 -10
- data/lib/core/occurances.rb +0 -20
- data/lib/core/received_criteria.rb +0 -14
- data/lib/core/received_occurances_criteria.rb +0 -16
- data/lib/core/version.rb +0 -5
- data/lib/fakes-rspec.rb +0 -16
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fakes-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -115,14 +115,6 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
- lib/core/block_criteria.rb
|
119
|
-
- lib/core/matcher.rb
|
120
|
-
- lib/core/nullo_specification.rb
|
121
|
-
- lib/core/occurances.rb
|
122
|
-
- lib/core/received_criteria.rb
|
123
|
-
- lib/core/received_occurances_criteria.rb
|
124
|
-
- lib/core/version.rb
|
125
|
-
- lib/fakes-rspec.rb
|
126
118
|
- spec/spec_helper.rb
|
127
119
|
- spec/specs/block_criteria_spec.rb
|
128
120
|
- spec/specs/nullo_specification_spec.rb
|
@@ -142,15 +134,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
134
|
- - ! '>='
|
143
135
|
- !ruby/object:Gem::Version
|
144
136
|
version: '0'
|
137
|
+
segments:
|
138
|
+
- 0
|
139
|
+
hash: -2011778260648523438
|
145
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
141
|
none: false
|
147
142
|
requirements:
|
148
143
|
- - ! '>='
|
149
144
|
- !ruby/object:Gem::Version
|
150
145
|
version: '0'
|
146
|
+
segments:
|
147
|
+
- 0
|
148
|
+
hash: -2011778260648523438
|
151
149
|
requirements: []
|
152
150
|
rubyforge_project: fakes-rspec
|
153
|
-
rubygems_version: 1.8.
|
151
|
+
rubygems_version: 1.8.25
|
154
152
|
signing_key:
|
155
153
|
specification_version: 3
|
156
154
|
summary: Utility functions for develowithpassion_fakes when working with rSpec
|
data/lib/core/block_criteria.rb
DELETED
data/lib/core/matcher.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
module RSpec
|
2
|
-
def self.create_received_criteria_from(the_call)
|
3
|
-
return Fakes::RSpec::ReceivedCriteria.new(the_call)
|
4
|
-
end
|
5
|
-
def self.create_received_occurences_criteria_from(the_call,occurence)
|
6
|
-
return Fakes::RSpec::ReceivedOccurencesCriteria.new(create_received_criteria_from(the_call),the_call,occurence)
|
7
|
-
end
|
8
|
-
|
9
|
-
Matchers.define :have_received do|symbol,*args|
|
10
|
-
@occurence_spec = Fakes::RSpec::NulloSpecification.instance
|
11
|
-
|
12
|
-
chain :once do
|
13
|
-
@occurence_spec = Fakes::RSpec::Occurances.exact(1)
|
14
|
-
end
|
15
|
-
chain :twice do
|
16
|
-
@occurence_spec = Fakes::RSpec::Occurances.exact(2)
|
17
|
-
end
|
18
|
-
chain :at_least_once do
|
19
|
-
@occurence_spec = Fakes::RSpec::Occurances.at_least(1)
|
20
|
-
end
|
21
|
-
chain :at_least_twice do
|
22
|
-
@occurence_spec = Fakes::RSpec::Occurances.at_least(2)
|
23
|
-
end
|
24
|
-
chain :at_most_once do
|
25
|
-
@occurence_spec = Fakes::RSpec::Occurances.at_most(1)
|
26
|
-
end
|
27
|
-
chain :at_most_twice do
|
28
|
-
@occurence_spec = Fakes::RSpec::Occurances.at_most(2)
|
29
|
-
end
|
30
|
-
chain :at_least do|times|
|
31
|
-
@occurence_spec = Fakes::RSpec::Occurances.at_least(times)
|
32
|
-
end
|
33
|
-
chain :at_most do|times|
|
34
|
-
@occurence_spec = Fakes::RSpec::Occurances.at_most(times)
|
35
|
-
end
|
36
|
-
chain :exactly do|times|
|
37
|
-
@occurence_spec = Fakes::RSpec::Occurances.exact(times)
|
38
|
-
end
|
39
|
-
chain :occurs do|the_proc|
|
40
|
-
@occurence_spec = Fakes::RSpec::Occurances.from_block(the_proc)
|
41
|
-
end
|
42
|
-
match do|the_fake|
|
43
|
-
RSpec.create_received_occurences_criteria_from(the_fake.received(symbol),@occurence_spec).is_satisfied_by(*args)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
data/lib/core/occurances.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
module Fakes
|
2
|
-
module RSpec
|
3
|
-
class Occurances
|
4
|
-
class << self
|
5
|
-
def from_block(the_block)
|
6
|
-
return BlockCriteria.new(the_block)
|
7
|
-
end
|
8
|
-
def exact(times)
|
9
|
-
return from_block(lambda{|occurances| return occurances == times})
|
10
|
-
end
|
11
|
-
def at_least(times)
|
12
|
-
return from_block(lambda { |occurences| return occurences >= times})
|
13
|
-
end
|
14
|
-
def at_most(times)
|
15
|
-
return from_block(lambda { |occurences| return occurences <= times})
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module Fakes
|
2
|
-
module RSpec
|
3
|
-
class ReceivedCriteria
|
4
|
-
def initialize(the_call)
|
5
|
-
@the_call = the_call
|
6
|
-
end
|
7
|
-
|
8
|
-
def is_satisfied_by(*args)
|
9
|
-
return false if @the_call == nil
|
10
|
-
return args.count == 0 ? true : @the_call.called_with(*args) != nil
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Fakes
|
2
|
-
module RSpec
|
3
|
-
class ReceivedOccurencesCriteria
|
4
|
-
def initialize(received_criteria,the_call,occurence)
|
5
|
-
@received_criteria = received_criteria
|
6
|
-
@the_call = the_call
|
7
|
-
@occurence = occurence
|
8
|
-
end
|
9
|
-
|
10
|
-
def is_satisfied_by(*args)
|
11
|
-
return @received_criteria.is_satisfied_by(*args) &&
|
12
|
-
@occurence.is_satisfied_by((args.count == 0 ? @the_call.total_times_called : @the_call.called_with(*args).times_called))
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/lib/core/version.rb
DELETED
data/lib/fakes-rspec.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'fakes'
|
2
|
-
require 'rspec'
|
3
|
-
require 'singleton'
|
4
|
-
|
5
|
-
require 'core/block_criteria'
|
6
|
-
require 'core/matcher'
|
7
|
-
require 'core/nullo_specification'
|
8
|
-
require 'core/occurances'
|
9
|
-
require 'core/received_occurances_criteria'
|
10
|
-
require 'core/received_criteria'
|
11
|
-
|
12
|
-
RSpec.configure do |config|
|
13
|
-
config.after(:each) do
|
14
|
-
reset_fake_classes
|
15
|
-
end
|
16
|
-
end
|