README.markdown in sham-1.1.0 vs README.markdown in sham-1.2.0
- old
+ new
@@ -198,11 +198,28 @@
during initialization:
LineItem.sham!
LineItem.sham!(:item => Item.sham!(:weight => 100))
+## Lazy Shams
+A more general form of Nested Sham is the Lazy Sham. Lazy Shams only evaluate
+their blocks if they are not overwritten.
+
+ # sham/line_item_sham.rb
+ Sham.config(LineItem) do |c|
+ c.attributes do
+ { :item_id => Sham::Lazy.new { Item.sham!.id } }
+ end
+ end
+
+The lazy shams will automatically be evaluated and can also be overwritten
+during initialization:
+
+ LineItem.sham!
+ LineItem.sham!(:item_id => Item.sham!(:weight => 100).id)
+
## Sham Inheritance
Sham plays well with inheritance. That means shams defined on parent classes
will be available to child classes as well.
@@ -237,5 +254,7 @@
This change will cause sham to be re-loaded so that you can continue to use it
with Spork. If you take this approach it's important to remove the call to
`Sham::Config.activate!` from your `test.rb` file.
## Build Status [](http://travis-ci.org/panthomakos/sham)
+
+## Code Quality [](https://codeclimate.com/github/panthomakos/sham)