adequack 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6cbd122c01215eb0d14f941fc68ecb1f147bfe3b
4
- data.tar.gz: 1dbcf7bc56ae09478d86f0ae47b6fe4f4db6040d
3
+ metadata.gz: 70f0291eb7ccd7aa8818463326c4a68c69bfc99b
4
+ data.tar.gz: caf67d45f2aa6efea859b1b8a89b5768417b8870
5
5
  SHA512:
6
- metadata.gz: 93f3f69ffbfaf2c76ca608bcc3bf4d1c51e652f601e203d08f59b601dbe2d86b11669b55237cda7671dd800783d262ce28bde0df55fc66834d6750ce4e7ec49a
7
- data.tar.gz: 13c964cd0d085001f92330d13468b149c49c2a820f756ca4ff2e571aaf369cdddad0057b41fe7266ae811129aac7e81b43f6386173b4e2540fc511f46fd6e75b
6
+ metadata.gz: 68d9434369d6c2a5866eb0dee4b535917fc12d3914a3bc4e03f88ae419e63f255e0d4add303c56cd30b8342685ffbe94af8eb87ab1176e44992e9c75c8130185
7
+ data.tar.gz: b6c93a4e560827abb4124db0065bfafcac9723c24d2d39c862c1026507ecc0b745a867f32ab9af11beade861a6ca5c2f717d4366242fa9a4a6a71a2cedc95b2b
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Version 0.0.2
2
+
3
+ * Class methods now counted too when trying to stub them
4
+
5
+ * Fix undefined method `new` for when checking for stubs
6
+
7
+ # Version 0.0.1
8
+
9
+ * Initial release
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Adequack
2
2
 
3
- Everyone likes isolation testing now. And when you do it then you stubbing and mocking a lot.
3
+ [![Gem Version](https://badge.fury.io/rb/adequack.png)](http://badge.fury.io/rb/adequack)
4
+ [![Build Status](https://travis-ci.org/Somebody32/adequack.png?branch=master)](https://travis-ci.org/Somebody32/adequack)
5
+ [![Dependency Status](https://gemnasium.com/Somebody32/adequack.png)](https://gemnasium.com/Somebody32/adequack)
6
+
7
+ Everyone likes isolation testing. And when you do it then you stubbing and mocking a lot.
4
8
  But the main concern when you use this approach is that you stubs will be out of sync with the
5
9
  real objects.
6
10
  Adequack addresses this issue.
data/lib/adequack/core.rb CHANGED
@@ -13,7 +13,7 @@ module Adequack
13
13
  end
14
14
 
15
15
  def validate_ducktype
16
- check_method_implementation(get_methods interface.public_methods )
16
+ check_method_implementation(get_methods interface.public_methods)
17
17
  check_method_implementation(
18
18
  get_methods(interface.public_instance_methods), true
19
19
  )
@@ -40,4 +40,4 @@ module Adequack
40
40
  methods - Object.methods
41
41
  end
42
42
  end
43
- end
43
+ end
@@ -76,10 +76,19 @@ module Adequack
76
76
  end
77
77
 
78
78
  def duck_type_methods
79
- @duck_type_methods ||= (interface.instance_methods - Object.methods)
80
- @duck_type_methods.map do |method_name|
81
- interface.public_instance_method(method_name)
79
+ @duck_type_methods ||= get_methods
80
+ end
81
+
82
+ def get_methods
83
+ cm = interface.methods.map do |m|
84
+ interface.public_method(m)
82
85
  end
86
+
87
+ im = interface.instance_methods.map do |m|
88
+ interface.public_instance_method(m)
89
+ end
90
+
91
+ cm + im
83
92
  end
84
93
  end
85
94
  end
@@ -1,3 +1,3 @@
1
1
  module Adequack
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -125,5 +125,11 @@ describe Adequack do
125
125
  }.to raise_error Adequack::InterfaceImplementationError,
126
126
  "definition of method 'bark' differs in parameters accepted."
127
127
  end
128
+
129
+ it "works with class method defs too" do
130
+ d = Adequack.double Class.new, interface
131
+ d.should_receive(:evolutionize)
132
+ d.evolutionize
133
+ end
128
134
  end
129
135
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adequack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Zayats
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-27 00:00:00.000000000 Z
11
+ date: 2013-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -61,6 +61,7 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - .gitignore
63
63
  - .rspec
64
+ - CHANGELOG.md
64
65
  - Gemfile
65
66
  - LICENSE.txt
66
67
  - README.md