Permalink
Browse files

Improve README

  • Loading branch information...
1 parent b5eecd4 commit c80c84c5347b814d22e55ccd87ab1463fe1e2b7a @narwen committed with Hashrocket Workstation Apr 4, 2012
Showing with 27 additions and 7 deletions.
  1. +27 −7 README.md
View
@@ -4,9 +4,11 @@ A simple interface for the state of objects under test. Useful as an interface a
## Installation
-Add this line to your application's Gemfile:
+Add this line to your application's `Gemfile`:
+```ruby
gem 'statefulton'
+```
And then execute:
@@ -16,7 +18,7 @@ Or install it yourself as:
$ gem install statefulton
-## Usage
+## How does it work
Defined DSL methods:
@@ -26,43 +28,61 @@ Defined DSL methods:
Accessing the state of something:
-* StateOf(:name, "context")
+```ruby
+ StateOf(:name, "context")
+```
Creating a statefulton:
-* Statefulton(:name) { # a block of calls to the DSL methods }
+```ruby
+ Statefulton(:name) { # a block of calls to the DSL methods }
+```
Reset state between tests:
-* Statefulton::Reset.all
+```ruby
+ Statefulton::Reset.all
+```
-To define a new statefulton:
+## Cucumber Usage
+To define a new statefulton on `features/support/statefulton.rb`:
+
+```ruby
Statefulton(:user) do
builder { User.new }
make "an"
expects "that" # Calling "that" will return the singular instance
end
+```
+
StateOf(:user, "that") #raise error: instance not created
StateOf(:user, "an") #build the object
StateOf(:user, "an") #raise error: instance already created
StateOf(:user, "that") #get the object
-Cucumber Usage:
+Define your cucumber feature on `features` or a subdirectory.
+
+```ruby
Given a user
When I activate that user
+```
+
+Define your steps on `features/steps`
+```ruby
Transform /^(a|that) user$/ do |state|
StateOf(:user, state)
end
When /^I activate (that user)$/ do |user|
user.activate!
end
+```
## Contributing

0 comments on commit c80c84c

Please sign in to comment.