README.markdown in sham-0.1.0 vs README.markdown in sham-0.2.0

- old
+ new

@@ -9,22 +9,27 @@ ## Getting Started Create a sham file for each of your models: # in sham/user_sham.rb - class Sham::UserSham < Sham::Core + class User::Sham def self.options { :name => "Sample User" } end end To enable Sham in a particular environment, add the following to your environment.rb or test.rb file: config.after_initialize do Sham::Config.activate! end + +To enable Sham in cucumber, add the following to your features/support/env.rb file: + require 'sham' + Sham::Config.activate! + You can now "sham" your models and pass additional attributes at creation: User.sham! User.sham! :name => "New Name" User.sham! :age => 23 @@ -42,11 +47,11 @@ class Item < ActiveRecord::Base validates_numericality_of :quantity, :greater_than => 0 end # in sham/item_sham.rb - class Sham::ItemSham < Sham::Core + class Item::Sham def self.options { :quantity => 1 } end end @@ -66,11 +71,11 @@ ## Shamming Alternatives You can add other alternative variations to the default "sham!" functionality: # in sham/item_sham.rb - class Sham::ItemSham < Sham::Core + class Item::Sham def self.options { :weight => 1.0 } end def self.large_options @@ -86,10 +91,10 @@ ## Nested Shamming You can nest shammed models inside others: # in sham/line_item_sham.rb - class Sham::LineItemSham < Sham::Core + class LineItem::Sham def self.options { :item => Sham::Base.new(Item) } end end \ No newline at end of file