Skip to content
Browse files

Name settled to MrProper!

Also added a note about it not working in other
rubies than 1.9.3 (ahem, ahem)
  • Loading branch information...
1 parent 4d881aa commit 86d3874073fb24246481cb2bb40a15aef21d0246 @porras committed Nov 6, 2011
View
2 .gitignore
@@ -1 +1 @@
-property-*.gem
+mrproper-*.gem
View
4 Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- property (0.0.1)
+ mrproper (0.0.1)
GEM
remote: http://rubygems.org/
@@ -12,5 +12,5 @@ PLATFORMS
ruby
DEPENDENCIES
- property!
+ mrproper!
rake
View
16 README.md
@@ -1,17 +1,17 @@
-# Property
+# MrProper
-Property is a [MiniTest](http://rubydoc.info/stdlib/minitest/1.9.2/frames)-based library to do Property Based Testing a la [Haskell](http://haskell.org/haskellwiki/Haskell)'s [QuickCheck](http://hackage.haskell.org/package/QuickCheck).
+MrProper is a [MiniTest](http://rubydoc.info/stdlib/minitest/1.9.2/frames)-based library to do Property Based Testing a la [Haskell](http://haskell.org/haskellwiki/Haskell)'s [QuickCheck](http://hackage.haskell.org/package/QuickCheck).
Property Based Testing is an alternative approach to unit testing for testing functional style functions/methods. Instead of using examples and testing the return value of your function for each example, you:
1. Define the kind of data your function/method is supposed to accept
2. Define predicates (properties) your function/method is supposed to comply with
-Then Property uses that info to randomly check lots of test cases so that you can find extra edge cases you might have forgotten in your unit tests or implementation.
+Then MrProper uses that info to randomly check lots of test cases so that you can find extra edge cases you might have forgotten in your unit tests or implementation.
-In order to do so, Property provides a very simple DSL, with just thre methods, `properties`, `data` and `property`. For example, we could describe a `double` function in terms of properties:
+In order to do so, MrProper provides a very simple DSL, with just three methods, `properties`, `data` and `property`. For example, we could describe a `double` function in terms of properties:
- require 'property'
+ require 'mrproper'
properties 'double' do
data Integer
@@ -39,7 +39,7 @@ After implementing `double` (we'll leave that as an exercise `;)`), we run the p
Only one test runs, but notice the insane number of assertions: a lot of random `Integer` and `Float` values generated for you.
-If we happen to have a buggy `double` implementation which fails for numbers greater than 20 (we're crappy developers, thats why we want tests!), Property will tell you the first case it finds that proves the property false:
+If we happen to have a buggy `double` implementation which fails for numbers greater than 20 (we're crappy developers, thats why we want tests!), MrProper will tell you the first case it finds that proves the property false:
def double(i)
return -666 if i > 20
@@ -92,6 +92,10 @@ In case this is not enough, you can just use a block and do whatever you want to
rand > 0.5 ? Wadus.new(rand(9)) : FooBar.new(rand(9))
end
+## Todo
+
+* Make it work in other rubies than 1.9.3
+
## License
Released under the [MIT license](http://github.com/porras/property/blob/master/LICENSE)
View
6 lib/mrproper.rb
@@ -0,0 +1,6 @@
+require 'minitest/autorun'
+require 'mrproper/base'
+require 'mrproper/dsl'
+require 'mrproper/core_extensions/string_extensions'
+
+include MrProper
View
4 lib/property/base.rb → lib/mrproper/base.rb
@@ -1,7 +1,7 @@
-module Property
+module MrProper
def properties(name, &block)
- dsl = Property::DSL.new
+ dsl = MrProper::DSL.new
dsl.instance_eval(&block)
Class.new(MiniTest::Unit::TestCase).class_eval do
include PropertiesHelper if const_defined?(:PropertiesHelper)
View
0 ...erty/core_extensions/string_extensions.rb → ...oper/core_extensions/string_extensions.rb
File renamed without changes.
View
2 lib/property/dsl.rb → lib/mrproper/dsl.rb
@@ -1,4 +1,4 @@
-module Property
+module MrProper
TESTS_PER_PROPERTY = 100
View
6 lib/property.rb
@@ -1,6 +0,0 @@
-require 'minitest/autorun'
-require 'property/base'
-require 'property/dsl'
-require 'property/core_extensions/string_extensions'
-
-include Property
View
4 property.gemspec → mrproper.gemspec
@@ -1,10 +1,10 @@
Gem::Specification.new do |s|
- s.name = "property"
+ s.name = "mrproper"
s.version = "0.0.1"
s.summary = "Property Based Testing library"
s.author = ["Sergio Gil", "Mari Carmen Gutiérrez"]
s.email = "sgilperez@gmail.com"
- s.homepage = "http://github.com/porras/property"
+ s.homepage = "http://github.com/porras/mrproper"
s.extra_rdoc_files = %w(README.md)
s.rdoc_options = %w(--main README.md)
View
2 properties/sample_properties.rb
@@ -1,4 +1,4 @@
-require 'property'
+require 'mrproper'
require 'properties_helper'
def double(i)
View
6 test/property/dsl_test.rb → test/mrproper/dsl_test.rb
@@ -1,14 +1,14 @@
require 'minitest/autorun'
require 'test_helper'
-require 'property'
+require 'mrproper'
class DSLTest < MiniTest::Unit::TestCase
include TestHelper
def setup
- Property::DSL.send :public, :data_block
- @pb = Property::DSL.new
+ MrProper::DSL.send :public, :data_block
+ @pb = MrProper::DSL.new
end
def test_data_block_with_block

0 comments on commit 86d3874

Please sign in to comment.
Something went wrong with that request. Please try again.