lib/prop_check/rspec.rb in prop_check-0.7.1 vs lib/prop_check/rspec.rb in prop_check-0.8.0
- old
+ new
@@ -1,18 +1,20 @@
module PropCheck
##
# Integration with RSpec
+ #
+ # Currently very basic; it does two things:
+ # 1. adds the local `forall` method to examples that calls `PropCheck.forall`
+ # 2. adds `include PropCheck::Generators` statement.
module RSpec
# To make it available within examples
def self.extend_object(obj)
+ obj.instance_eval do
+ include PropCheck::Generators
+ end
+
obj.define_method(:forall) do |*args, **kwargs, &block|
- if block_given?
- PropCheck::Property.forall(*args, **kwargs) do
- instance_exec(self, &block)
- end
- else
- PropCheck::Property.forall(*args, **kwargs)
- end
+ PropCheck.forall(*args, **kwargs, &block)
end
end
end
end