facon 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Changelog.txt +18 -1
- data/Gemfile +4 -0
- data/Gemfile.lock +16 -0
- data/README.txt +5 -11
- data/Rakefile +1 -16
- data/facon.gemspec +21 -0
- data/lib/facon.rb +1 -1
- data/lib/facon/baconize.rb +3 -3
- data/lib/facon/expectation.rb +2 -2
- data/lib/facon/version.rb +3 -0
- data/spec/baconize_spec.rb +4 -3
- data/spec/expectation_spec.rb +2 -2
- data/spec/mock_spec.rb +2 -2
- data/spec/stub_spec.rb +2 -2
- metadata +49 -27
- data/History.txt +0 -16
- data/Manifest.txt +0 -18
data/.gitignore
ADDED
data/Changelog.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
=== 0.5.0
|
2
|
+
* Added Ruby 1.9.2 compatibility. Thanks ymendel!
|
3
|
+
* Get rid of that dependency on hoe, use Bundler to manage gem release.
|
4
|
+
|
1
5
|
=== 0.4.1 / 2008-12-05
|
2
6
|
|
3
7
|
* Added #times, #once and #never expectation matchers. Thanks raggi!
|
@@ -12,4 +16,17 @@
|
|
12
16
|
|
13
17
|
=== 0.3.1 / 2008-02-19
|
14
18
|
|
15
|
-
* Fixed a bug where mocks were not being teared down when there is a previous spec failure.
|
19
|
+
* Fixed a bug where mocks were not being teared down when there is a previous spec failure.
|
20
|
+
|
21
|
+
=== 0.3 / 2008-02-18
|
22
|
+
|
23
|
+
* Fixed a bug with proxied methods not being cleared.
|
24
|
+
* Fixed a bug where the same mocks were repeatedly being added to $facon_mocks.
|
25
|
+
|
26
|
+
=== 0.2 / 2008-02-13
|
27
|
+
|
28
|
+
* Use #after block to verify mocks so that the stack trace is more helpful (it now actually shows the line in the spec where the mock error occurred).
|
29
|
+
|
30
|
+
=== 0.1 / 2008-02-09
|
31
|
+
|
32
|
+
* First release!
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.txt
CHANGED
@@ -4,7 +4,7 @@ Facon is a mocking library in the spirit of the Bacon spec library. Small, compa
|
|
4
4
|
|
5
5
|
== Synopsis
|
6
6
|
|
7
|
-
To use Facon with Bacon[
|
7
|
+
To use Facon with Bacon[https://github.com/chneukirchen/bacon], simply <code>require 'facon'</code> and you're done.
|
8
8
|
|
9
9
|
You can now write Bacon specs like this (in RSpec-like style):
|
10
10
|
|
@@ -33,7 +33,7 @@ You can now write Bacon specs like this (in RSpec-like style):
|
|
33
33
|
For now, more examples can be found in the specs included with the Facon gem. I promise to get better examples into the
|
34
34
|
documentation!
|
35
35
|
|
36
|
-
See Facon::Baconize for more documentation on using Facon with Bacon[
|
36
|
+
See Facon::Baconize for more documentation on using Facon with Bacon[https://github.com/chneukirchen/bacon].
|
37
37
|
|
38
38
|
== Requirements
|
39
39
|
|
@@ -59,13 +59,6 @@ Simply install the gem:
|
|
59
59
|
You can get the latest trunk from the Git repository on Github:
|
60
60
|
git://github.com/chuyeow/facon.git
|
61
61
|
|
62
|
-
== Links
|
63
|
-
|
64
|
-
* Github page - http://github.com/chuyeow/facon/
|
65
|
-
* Facon website - http://facon.rubyforge.org/
|
66
|
-
* Bacon - http://rubyforge.org/projects/test-spec/
|
67
|
-
* RSpec - http://rspec.info/
|
68
|
-
|
69
62
|
== Todos
|
70
63
|
|
71
64
|
* test/unit and RSpec integration.
|
@@ -76,11 +69,12 @@ You can get the latest trunk from the Git repository on Github:
|
|
76
69
|
== Contributors
|
77
70
|
|
78
71
|
* raggi (http://blog.ra66i.org/) for #times, #once, #never expectation matchers.
|
72
|
+
* ymendel (Yossef Mendelssohn) for Ruby 1.9.2 compatibility fixes.
|
79
73
|
|
80
74
|
== Thanks to
|
81
75
|
|
82
|
-
* RSpec (
|
83
|
-
* Christian Neukirchen
|
76
|
+
* RSpec (https://www.relishapp.com/rspec) for creating spec/mocks, from which a lot of the code for Facon is stolen.
|
77
|
+
* Christian Neukirchen for creating Bacon.
|
84
78
|
|
85
79
|
== License:
|
86
80
|
|
data/Rakefile
CHANGED
@@ -1,16 +1 @@
|
|
1
|
-
require '
|
2
|
-
require 'hoe'
|
3
|
-
$:.unshift(File.dirname(__FILE__) + '/lib')
|
4
|
-
require 'facon'
|
5
|
-
|
6
|
-
Hoe.new('facon', Facon::VERSION) do |p|
|
7
|
-
p.rubyforge_name = 'facon'
|
8
|
-
p.author = 'Cheah Chu Yeow'
|
9
|
-
p.email = 'chuyeow@gmail.com'
|
10
|
-
p.summary = 'Tiny mocking library.'
|
11
|
-
p.url = 'http://github.com/chuyeow/facon/'
|
12
|
-
p.description = 'A mocking library in the spirit of the Bacon spec library. Small, compact, and works with Bacon.'
|
13
|
-
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
14
|
-
p.remote_rdoc_dir = 'rdocs'
|
15
|
-
# p.clean_globs = ['test/actual'] # Remove this directory on "rake clean"
|
16
|
-
end
|
1
|
+
require 'bundler/gem_tasks'
|
data/facon.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'facon/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'facon'
|
6
|
+
s.version = Facon::VERSION
|
7
|
+
s.authors = ['chuyeow']
|
8
|
+
s.email = ['chuyeow@gmail.com']
|
9
|
+
s.homepage = 'https://github.com/chuyeow/facon'
|
10
|
+
s.summary = %q{Tiny mocking library.}
|
11
|
+
s.description = %q{A mocking library in the spirit of the Bacon spec library. Small, compact, and works with Bacon.}
|
12
|
+
|
13
|
+
s.rubyforge_project = 'facon'
|
14
|
+
|
15
|
+
s.add_development_dependency 'bacon'
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ['lib']
|
21
|
+
end
|
data/lib/facon.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
2
2
|
|
3
|
+
require 'facon/version'
|
3
4
|
require 'facon/mockable'
|
4
5
|
require 'facon/mock'
|
5
6
|
require 'facon/error_generator'
|
@@ -12,5 +13,4 @@ require 'facon/core_ext/object'
|
|
12
13
|
# Facon is a mocking library in the spirit of the Bacon spec library. Small,
|
13
14
|
# compact, and works with Bacon.
|
14
15
|
module Facon
|
15
|
-
VERSION = '0.4.1'
|
16
16
|
end
|
data/lib/facon/baconize.rb
CHANGED
@@ -51,8 +51,8 @@ module Facon
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def it_with_mock_verification(description, &block)
|
54
|
-
@before.unshift(
|
55
|
-
@after <<
|
54
|
+
@before.unshift(proc { setup_facon_mocks })
|
55
|
+
@after << proc { verify_facon_mocks }
|
56
56
|
it_without_mock_verification(description, &block)
|
57
57
|
ensure
|
58
58
|
teardown_facon_mocks
|
@@ -100,4 +100,4 @@ rescue NameError
|
|
100
100
|
Should.class_eval { include Facon::Baconize::ShouldExtensions }
|
101
101
|
rescue LoadError
|
102
102
|
puts 'Bacon is not available.'
|
103
|
-
end
|
103
|
+
end
|
data/lib/facon/expectation.rb
CHANGED
@@ -28,7 +28,7 @@ module Facon
|
|
28
28
|
def and_return(value)
|
29
29
|
raise MockExpectationError, 'Ambiguous return expectation' unless @method_block.nil?
|
30
30
|
|
31
|
-
@return_block =
|
31
|
+
@return_block = proc { value }
|
32
32
|
end
|
33
33
|
|
34
34
|
# Sets up the expected method to yield with the given arguments.
|
@@ -136,4 +136,4 @@ module Facon
|
|
136
136
|
@method == method
|
137
137
|
end
|
138
138
|
end
|
139
|
-
end
|
139
|
+
end
|
data/spec/baconize_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "Facon::Baconize" do
|
4
4
|
|
@@ -7,7 +7,8 @@ describe "Facon::Baconize" do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
it "should make the #receive instance method available to Should" do
|
10
|
-
Should.public_instance_methods.
|
10
|
+
methods = Should.public_instance_methods.collect { |m| m.to_s }
|
11
|
+
methods.should.include?('receive')
|
11
12
|
end
|
12
13
|
|
13
14
|
it "should allow expectations on mocks with should.receive(:message)" do
|
@@ -32,4 +33,4 @@ describe "Facon::Baconize" do
|
|
32
33
|
Object.message.should == :foo
|
33
34
|
@object.message.should == :bar
|
34
35
|
end
|
35
|
-
end
|
36
|
+
end
|
data/spec/expectation_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "A mock object" do
|
4
4
|
before do
|
@@ -182,4 +182,4 @@ describe "A mock object" do
|
|
182
182
|
|
183
183
|
lambda { @mock.spec_verify }.should.raise(Facon::MockExpectationError).message.should == "Mock 'test mock' expected :message with (any args) 0 times, but received it 1 time"
|
184
184
|
end
|
185
|
-
end
|
185
|
+
end
|
data/spec/mock_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "Facon::Mock" do
|
4
4
|
before do
|
@@ -19,4 +19,4 @@ describe "Facon::Mock" do
|
|
19
19
|
non_mock.stubbed_method.should == :stub_value
|
20
20
|
non_mock.stubbed_method.should == :stub_value # called twice to ensure it stays
|
21
21
|
end
|
22
|
-
end
|
22
|
+
end
|
data/spec/stub_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
3
|
describe "A method stub" do
|
4
4
|
before do
|
@@ -124,4 +124,4 @@ describe "A method stub with arguments" do
|
|
124
124
|
@object.stubbed_method(:expected_arg).should == :stubbed_value
|
125
125
|
@object.stubbed_method(:something_else).should == :bar
|
126
126
|
end
|
127
|
-
end
|
127
|
+
end
|
metadata
CHANGED
@@ -1,44 +1,54 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 11
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 0.5.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
|
-
-
|
13
|
+
- chuyeow
|
8
14
|
autorequire:
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2011-10-06 00:00:00 +08:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
name: bacon
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
25
35
|
description: A mocking library in the spirit of the Bacon spec library. Small, compact, and works with Bacon.
|
26
|
-
email:
|
36
|
+
email:
|
37
|
+
- chuyeow@gmail.com
|
27
38
|
executables: []
|
28
39
|
|
29
40
|
extensions: []
|
30
41
|
|
31
|
-
extra_rdoc_files:
|
32
|
-
|
33
|
-
- History.txt
|
34
|
-
- Manifest.txt
|
35
|
-
- README.txt
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
36
44
|
files:
|
45
|
+
- .gitignore
|
37
46
|
- Changelog.txt
|
38
|
-
-
|
39
|
-
-
|
47
|
+
- Gemfile
|
48
|
+
- Gemfile.lock
|
40
49
|
- README.txt
|
41
50
|
- Rakefile
|
51
|
+
- facon.gemspec
|
42
52
|
- lib/facon.rb
|
43
53
|
- lib/facon/baconize.rb
|
44
54
|
- lib/facon/core_ext/object.rb
|
@@ -47,37 +57,49 @@ files:
|
|
47
57
|
- lib/facon/mock.rb
|
48
58
|
- lib/facon/mockable.rb
|
49
59
|
- lib/facon/proxy.rb
|
60
|
+
- lib/facon/version.rb
|
50
61
|
- spec/baconize_spec.rb
|
51
62
|
- spec/expectation_spec.rb
|
52
63
|
- spec/mock_spec.rb
|
53
64
|
- spec/spec_helper.rb
|
54
65
|
- spec/stub_spec.rb
|
55
66
|
has_rdoc: true
|
56
|
-
homepage:
|
67
|
+
homepage: https://github.com/chuyeow/facon
|
68
|
+
licenses: []
|
69
|
+
|
57
70
|
post_install_message:
|
58
|
-
rdoc_options:
|
59
|
-
|
60
|
-
- README.txt
|
71
|
+
rdoc_options: []
|
72
|
+
|
61
73
|
require_paths:
|
62
74
|
- lib
|
63
75
|
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
64
77
|
requirements:
|
65
78
|
- - ">="
|
66
79
|
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
67
83
|
version: "0"
|
68
|
-
version:
|
69
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
70
86
|
requirements:
|
71
87
|
- - ">="
|
72
88
|
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
73
92
|
version: "0"
|
74
|
-
version:
|
75
93
|
requirements: []
|
76
94
|
|
77
95
|
rubyforge_project: facon
|
78
|
-
rubygems_version: 1.
|
96
|
+
rubygems_version: 1.5.2
|
79
97
|
signing_key:
|
80
|
-
specification_version:
|
98
|
+
specification_version: 3
|
81
99
|
summary: Tiny mocking library.
|
82
|
-
test_files:
|
83
|
-
|
100
|
+
test_files:
|
101
|
+
- spec/baconize_spec.rb
|
102
|
+
- spec/expectation_spec.rb
|
103
|
+
- spec/mock_spec.rb
|
104
|
+
- spec/spec_helper.rb
|
105
|
+
- spec/stub_spec.rb
|
data/History.txt
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
=== 0.3.1 / 2008-02-19
|
2
|
-
|
3
|
-
* Fixed a bug where mocks were not being teared down when there is a previous spec failure.
|
4
|
-
|
5
|
-
=== 0.3 / 2008-02-18
|
6
|
-
|
7
|
-
* Fixed a bug with proxied methods not being cleared.
|
8
|
-
* Fixed a bug where the same mocks were repeatedly being added to $facon_mocks.
|
9
|
-
|
10
|
-
=== 0.2 / 2008-02-13
|
11
|
-
|
12
|
-
* Use #after block to verify mocks so that the stack trace is more helpful (it now actually shows the line in the spec where the mock error occurred).
|
13
|
-
|
14
|
-
=== 0.1 / 2008-02-09
|
15
|
-
|
16
|
-
* First release!
|
data/Manifest.txt
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Changelog.txt
|
2
|
-
History.txt
|
3
|
-
Manifest.txt
|
4
|
-
README.txt
|
5
|
-
Rakefile
|
6
|
-
lib/facon.rb
|
7
|
-
lib/facon/baconize.rb
|
8
|
-
lib/facon/core_ext/object.rb
|
9
|
-
lib/facon/error_generator.rb
|
10
|
-
lib/facon/expectation.rb
|
11
|
-
lib/facon/mock.rb
|
12
|
-
lib/facon/mockable.rb
|
13
|
-
lib/facon/proxy.rb
|
14
|
-
spec/baconize_spec.rb
|
15
|
-
spec/expectation_spec.rb
|
16
|
-
spec/mock_spec.rb
|
17
|
-
spec/spec_helper.rb
|
18
|
-
spec/stub_spec.rb
|