contractinator 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed606aefaecfff4239703067517b0e2495037758
4
- data.tar.gz: 6a64d437ec0b6b153db93a25f6c83613ce81c025
3
+ metadata.gz: 1ec84970a63096af873fe2392b3ca1f02b2c7e1d
4
+ data.tar.gz: 6d70e52f2ad58bc4a58eecbecc4ea4f0ec41a89c
5
5
  SHA512:
6
- metadata.gz: 299543f8aa70f979522e24a6842b8c08634917bb09e21484fc57f0070316ade14214bb5bc50360ccfa22c38461577ef7d5a7f63b3f4d3f8feb8d2b06add50dda
7
- data.tar.gz: 3b5dc5509088f867cace9640cbece9b3e949eeeda4f020fb24eed42637d469c8a0bfb9ffd9acb44cdf037c70d50b5feff2f553e984ebcecf1a386bd781e8ef4c
6
+ metadata.gz: e8e4e12538c51b1396eee7c449950e672dd8d8772de2e3314fa4a3a282a76d6d7ab06cf30deb3650b986086b30bdef36f04d188cab20a36cf6ddbf5f42ee196d
7
+ data.tar.gz: 7d045e37fd9984714ceda3d24ca0b7d75665cbe93c3efc820734b06ac308000abb2a114a5fd17f2468d5cbc6af646f4e1cfb6e9b034adc9319e7797f3ae245a4
@@ -1,3 +1,5 @@
1
+ require 'set'
2
+
1
3
  module Contractinator
2
4
  module Contract
3
5
  extend self
@@ -117,8 +117,12 @@ module Contractinator
117
117
  def must(matcher)
118
118
  @matcher = matcher
119
119
 
120
- if matcher.is_a?(RSpec::Rails::Matchers::RoutingMatchers::RouteToMatcher)
121
- contract_route_to_matcher
120
+ if defined?(RSpec::Rails::Matchers::RoutingMatchers::RouteToMatcher)
121
+ if matcher.is_a?(RSpec::Rails::Matchers::RoutingMatchers::RouteToMatcher)
122
+ contract_route_to_matcher
123
+ else
124
+ contract_receive_matcher
125
+ end
122
126
  else
123
127
  contract_receive_matcher
124
128
  end
@@ -4,6 +4,7 @@ require_relative 'core_extensions/hash'
4
4
  require_relative 'core_extensions/object'
5
5
  require_relative 'core_extensions/symbol'
6
6
  require_relative 'core_extensions/string'
7
+ require_relative 'core_extensions/nil_class'
7
8
 
8
9
  module Contractinator
9
10
  ::Object.include(CoreExtensions::Object)
@@ -13,4 +14,5 @@ module Contractinator
13
14
  ::Hash.include(CoreExtensions::Hash)
14
15
  ::String.include(CoreExtensions::String)
15
16
  ::Symbol.include(CoreExtensions::Symbol)
17
+ ::NilClass.include(CoreExtensions::NilClass)
16
18
  end
@@ -10,7 +10,9 @@ module Contractinator
10
10
  end
11
11
 
12
12
  def instance_contract_inspect
13
- to_s.underscore
13
+ class_contract_inspect.gsub(/([a-z])([A-Z])/) do |p, n|
14
+ "#{p}_#{n.downcase}"
15
+ end.downcase
14
16
  end
15
17
  end
16
18
  end
@@ -0,0 +1,8 @@
1
+ module Contractinator
2
+ module CoreExtensions
3
+ module NilClass
4
+ def try *args, &block
5
+ end
6
+ end
7
+ end
8
+ end
@@ -1,16 +1,20 @@
1
1
  module Contractinator
2
2
  module CoreExtensions
3
3
  module Object
4
+ def try msg, *args, &block
5
+ send(msg, *args, &block)
6
+ end
7
+
4
8
  def contract_inspect
5
9
  instance_contract_inspect
6
10
  end
7
11
 
8
12
  def class_contract_inspect
9
- self.class.to_s
13
+ self.class.class_contract_inspect
10
14
  end
11
15
 
12
16
  def instance_contract_inspect
13
- self.class.to_s.underscore
17
+ self.class.instance_contract_inspect
14
18
  end
15
19
  end
16
20
  end
@@ -1,3 +1,3 @@
1
1
  module Contractinator
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contractinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ehren Murdick
@@ -80,6 +80,7 @@ files:
80
80
  - lib/contractinator/core_extensions/array.rb
81
81
  - lib/contractinator/core_extensions/class.rb
82
82
  - lib/contractinator/core_extensions/hash.rb
83
+ - lib/contractinator/core_extensions/nil_class.rb
83
84
  - lib/contractinator/core_extensions/object.rb
84
85
  - lib/contractinator/core_extensions/string.rb
85
86
  - lib/contractinator/core_extensions/symbol.rb