verified_double 0.8.0 → 0.8.1

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: f8e1baaa1b9eda731d0b34f43fccd89258e0103f
4
- data.tar.gz: 55add943b1d237e527a18956d51f804577947bb1
3
+ metadata.gz: 227d5bbfad5bc889bac73cee492aecdf58590306
4
+ data.tar.gz: 575d210a0ddbc0b3c773b8f0ca81a8c7553ef3fa
5
5
  SHA512:
6
- metadata.gz: 79d26b5f3debd6e9700c4ba4ac901c905e8f444a008ac1bd552c797b8f6fbdbdea044d8a8b28dce766c6b79327eb42f1cfcab69951ebba4f7bb0e18ad7798871
7
- data.tar.gz: 4c3a954df4a90e1e66089b0b447ef04361d305bf200632f82e7b7aa044f3549482d5c792044c81c69acf2c7c4e65e760f1e6ef99e2ff496ad92c3b9b0cf7fa98
6
+ metadata.gz: ddadca8f1ffcd2f62ddb53b184b8b620b930b9050e76687bc0d61dbb9b267a9c1d0506cffff2f96de3cee548144e7d497d22c5c56f70f638b5f9c7610ab0ae3e
7
+ data.tar.gz: 365a908a9b52f06de299cf9819282e1b524b94c146d8104f5a8d1ab796e81f8ec6de3646338163ac7a1a1cee5f27245c95333d8d64911b66e48f438e1794fa11
@@ -1,3 +1,8 @@
1
+ 0.8.1 - 2014-03-04
2
+ ------------------
3
+
4
+ * Better error handling for invalid described_class and method in contract specs.
5
+
1
6
  0.8.0 - 2014-01-30
2
7
  ------------------
3
8
 
@@ -1,3 +1,8 @@
1
+ 0.8.1 - 2014-03-04
2
+ ------------------
3
+
4
+ * Better error handling for invalid described_class and method in contract specs.
5
+
1
6
  0.8.0 - 2014-01-30
2
7
  ------------------
3
8
 
@@ -3,10 +3,13 @@ module VerifiedDouble
3
3
  def described_class
4
4
  if description.is_a?(Module)
5
5
  description
6
- elsif description.is_a?(String)
6
+ elsif !metadata[:example_group].nil?
7
7
  ExampleMetadata.new(metadata[:example_group]).described_class
8
8
  else
9
- raise
9
+ raise StandardError,
10
+ "The VerifiedDouble contract spec described class '#{description}' is
11
+ invalid. The described class must be a class or a module."
12
+ .gsub(/\s+/, ' ')
10
13
  end
11
14
  end
12
15
 
@@ -17,8 +20,11 @@ module VerifiedDouble
17
20
  def method_signature_string
18
21
  if description =~ /^[\.\#]/
19
22
  description
20
- elsif description.nil?
21
- raise
23
+ elsif metadata[:example_group].nil?
24
+ raise StandardError,
25
+ "The VerifiedDouble contract spec method '#{description}' is invalid.
26
+ The method must start with # or ."
27
+ .gsub(/\s+/, ' ')
22
28
  else
23
29
  ExampleMetadata.new(metadata[:example_group]).method_signature_string
24
30
  end
@@ -1,3 +1,3 @@
1
1
  module VerifiedDouble
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
@@ -34,16 +34,15 @@ describe VerifiedDouble::ExampleMetadata do
34
34
  end
35
35
 
36
36
  context "where the described class is a string" do
37
- let(:metadata) do
38
- {
39
- example_group: {
40
- description_args: [klass.to_s]
41
- }
42
- }
43
- end
37
+ let(:klass) { Object.to_s }
44
38
 
45
39
  it "should raise an error" do
46
- expect(-> { subject.described_class }).to raise_error
40
+ expect(-> { subject.described_class }).to raise_error(
41
+ StandardError, "The VerifiedDouble contract spec described class
42
+ 'Object' is invalid.
43
+ The described class must be a class or a module."
44
+ .gsub(/\s+/, ' ')
45
+ )
47
46
  end
48
47
  end
49
48
  end
@@ -54,16 +53,14 @@ describe VerifiedDouble::ExampleMetadata do
54
53
  end
55
54
 
56
55
  context "where there is no description arg that looks like a method signature" do
57
- let(:metadata) do
58
- {
59
- example_group: {
60
- description_args: [klass.to_s]
61
- }
62
- }
63
- end
56
+ let(:method_signature_string) { 'to_s()=>String' }
64
57
 
65
58
  it "should raise an error" do
66
- expect(-> { subject.method_signature_string }).to raise_error
59
+ expect(-> { subject.method_signature_string }).to raise_error(
60
+ StandardError, "The VerifiedDouble contract spec method 'Object' is
61
+ invalid.
62
+ The method must start with # or .".gsub(/\s+/, ' ')
63
+ )
67
64
  end
68
65
  end
69
66
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: verified_double
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Mendoza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-30 00:00:00.000000000 Z
11
+ date: 2014-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport