fakes 1.0.9 → 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,6 +3,3 @@ blah.rb
3
3
  .bundle
4
4
  Gemfile.lock
5
5
  pkg/*
6
- .rmvrc
7
- .ruby-version
8
- .ruby-gemset
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ volumes_machd_to_backup_repositories_github_fakes
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p429
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm 1.9.3@fakes --create
data/fakes.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib",__FILE__)
3
- require "fakes/version"
3
+ require "core/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "fakes"
File without changes
@@ -2,28 +2,28 @@ module Fakes
2
2
  class Matches
3
3
  class << self
4
4
  def not_nil
5
- condition { |item| item != nil }
5
+ condition{|item| item != nil}
6
6
  end
7
7
 
8
8
  def nil
9
- condition { |item| item == nil }
9
+ condition{|item| item == nil}
10
10
  end
11
11
 
12
12
  def any
13
- condition { |ignored| true }
13
+ condition{|ignored| true}
14
14
  end
15
15
 
16
16
  def greater_than(value)
17
- condition { |number| number > value }
17
+ condition{|number| number > value}
18
18
  end
19
19
 
20
20
 
21
21
  def in_range(range)
22
- condition { |item| range === item }
22
+ condition{|item| range === item}
23
23
  end
24
24
 
25
- def regex(pattern)
26
- condition { |string_value| pattern =~ string_value }
25
+ def regex(regex)
26
+ condition{|string| regex =~ string}
27
27
  end
28
28
 
29
29
  def condition(&conditional_block)
File without changes
File without changes
File without changes
File without changes
@@ -12,7 +12,7 @@ module Fakes
12
12
 
13
13
  def capture_args(args)
14
14
  @times_called += 1
15
- self.arg_sets << args
15
+ arg_sets << args
16
16
  end
17
17
 
18
18
  def matches?(args)
@@ -21,7 +21,7 @@ module Fakes
21
21
 
22
22
  def was_called_with?(args)
23
23
  matcher = ArgMatchFactory.create_arg_matcher_using(args)
24
- return self.arg_sets.select{|set| matcher.matches?(set)}.count > 0
24
+ return @arg_sets.select{|set| matcher.matches?(set)}.count > 0
25
25
  end
26
26
  end
27
27
  end
@@ -4,13 +4,13 @@ module Fakes
4
4
  @arg_sets = arg_sets
5
5
  end
6
6
 
7
- def add_new_argument_set(set)
7
+ def add_new_set(set)
8
8
  @arg_sets << set
9
9
  set
10
10
  end
11
11
 
12
12
  def with(*args)
13
- return add_new_argument_set(ArgSet.new(args))
13
+ return add_new_set(ArgSet.new(args))
14
14
  end
15
15
 
16
16
  def throws(exception)
@@ -18,13 +18,14 @@ module Fakes
18
18
  end
19
19
 
20
20
  def ignore_arg
21
- return add_new_argument_set(IgnoreSet.new)
21
+ return add_new_set(IgnoreSet.new)
22
22
  end
23
23
 
24
24
  def and_return(item)
25
25
  ignore_arg.and_return(item)
26
26
  end
27
27
 
28
+
28
29
  def invoke(args)
29
30
  set = @arg_sets.find{|item| item.matches?(args)} || ignore_arg
30
31
  set.capture_args(args)
@@ -0,0 +1,3 @@
1
+ module Fakes
2
+ VERSION = "1.0.22"
3
+ end
data/lib/fakes.rb CHANGED
@@ -1,17 +1,34 @@
1
- require 'fakes/arg_matching/arg_match_factory'
2
- require 'fakes/arg_matching/block_arg_matcher'
3
- require 'fakes/arg_matching/combined_arg_matcher'
4
- require 'fakes/arg_matching/matches'
5
- require 'fakes/arg_matching/regular_arg_matcher'
6
- require 'fakes/arg_behaviour'
7
- require 'fakes/arg_set'
8
- require 'fakes/class_swap'
9
- require 'fakes/class_swaps'
10
- require 'fakes/fake'
11
- require 'fakes/ignore_set'
12
- require 'fakes/method_stub'
13
- require 'fakes/fakes'
14
-
1
+ require 'core/arg_matching/arg_match_factory'
2
+ require 'core/arg_matching/block_arg_matcher'
3
+ require 'core/arg_matching/combined_arg_matcher'
4
+ require 'core/arg_matching/matches'
5
+ require 'core/arg_matching/regular_arg_matcher'
6
+ require 'core/arg_behaviour'
7
+ require 'core/arg_set'
8
+ require 'core/class_swap'
9
+ require 'core/class_swaps'
10
+ require 'core/fake'
11
+ require 'core/ignore_set'
12
+ require 'core/method_stub'
15
13
  require 'singleton'
16
14
 
15
+ module Fakes
16
+ def fake(invocations = {})
17
+ item = Fakes::Fake.new
18
+ invocations.each{|method,return_value| item.stub(method).and_return(return_value)}
19
+ item
20
+ end
21
+ def arg_match
22
+ return Fakes::Matches
23
+ end
24
+ def fake_class(klass,invocations = {})
25
+ item = fake(invocations)
26
+ Fakes::ClassSwaps.instance.add_fake_for(klass,item)
27
+ item
28
+ end
29
+ def reset_fake_classes
30
+ Fakes::ClassSwaps.instance.reset
31
+ end
32
+ end
33
+
17
34
  include Fakes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.22
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -84,27 +84,29 @@ extensions: []
84
84
  extra_rdoc_files: []
85
85
  files:
86
86
  - .gitignore
87
+ - .ruby-gemset
88
+ - .ruby-version
89
+ - .rvmrc
87
90
  - Gemfile
88
91
  - Guardfile
89
92
  - LICENSE
90
93
  - README.md
91
94
  - Rakefile
92
95
  - fakes.gemspec
96
+ - lib/core/arg_behaviour.rb
97
+ - lib/core/arg_matching/arg_match_factory.rb
98
+ - lib/core/arg_matching/block_arg_matcher.rb
99
+ - lib/core/arg_matching/combined_arg_matcher.rb
100
+ - lib/core/arg_matching/matches.rb
101
+ - lib/core/arg_matching/regular_arg_matcher.rb
102
+ - lib/core/arg_set.rb
103
+ - lib/core/class_swap.rb
104
+ - lib/core/class_swaps.rb
105
+ - lib/core/fake.rb
106
+ - lib/core/ignore_set.rb
107
+ - lib/core/method_stub.rb
108
+ - lib/core/version.rb
93
109
  - lib/fakes.rb
94
- - lib/fakes/arg_behaviour.rb
95
- - lib/fakes/arg_matching/arg_match_factory.rb
96
- - lib/fakes/arg_matching/block_arg_matcher.rb
97
- - lib/fakes/arg_matching/combined_arg_matcher.rb
98
- - lib/fakes/arg_matching/matches.rb
99
- - lib/fakes/arg_matching/regular_arg_matcher.rb
100
- - lib/fakes/arg_set.rb
101
- - lib/fakes/class_swap.rb
102
- - lib/fakes/class_swaps.rb
103
- - lib/fakes/fake.rb
104
- - lib/fakes/fakes.rb
105
- - lib/fakes/ignore_set.rb
106
- - lib/fakes/method_stub.rb
107
- - lib/fakes/version.rb
108
110
  - spec/spec_helper.rb
109
111
  - spec/specs/arg_behaviour_spec.rb
110
112
  - spec/specs/arg_match_factory_spec.rb
@@ -134,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
136
  version: '0'
135
137
  segments:
136
138
  - 0
137
- hash: -1934458642077196737
139
+ hash: 4367574655946690097
138
140
  required_rubygems_version: !ruby/object:Gem::Requirement
139
141
  none: false
140
142
  requirements:
@@ -143,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
145
  version: '0'
144
146
  segments:
145
147
  - 0
146
- hash: -1934458642077196737
148
+ hash: 4367574655946690097
147
149
  requirements: []
148
150
  rubyforge_project: fakes
149
151
  rubygems_version: 1.8.25
data/lib/fakes/fakes.rb DELETED
@@ -1,22 +0,0 @@
1
- module Fakes
2
- def fake(invocations = {})
3
- item = Fakes::Fake.new
4
- invocations.each{|method,return_value| item.stub(method).and_return(return_value)}
5
- item
6
- end
7
-
8
- def arg_match
9
- return Fakes::Matches
10
- end
11
-
12
- def fake_class(klass,invocations = {})
13
- item = fake(invocations)
14
- Fakes::ClassSwaps.instance.add_fake_for(klass,item)
15
- item
16
- end
17
-
18
- def reset_fake_classes
19
- Fakes::ClassSwaps.instance.reset
20
- end
21
- end
22
-
data/lib/fakes/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module Fakes
2
- VERSION = "1.0.9"
3
- end