Permalink
Browse files

Improving the documentation for display on relishapp.com/RiverGlide/c…

…ukesalad
  • Loading branch information...
1 parent e227de5 commit 05695ee9d2de28785dd376fcb05ae08bccfd4fc9 @antonymarcano antonymarcano committed Jul 4, 2011
@@ -0,0 +1,31 @@
+## Defining Roles
+
+Your first step in your scenarios or in your background names a role relevant to your feature.
+Cukesalad has an actor that adopts this role at run-time.
+
+For example:
+
+ Given I am a Calculating Individual
+
+This will find a role called `CalculatingIndividual`.
+This role will have the methods that you call from within the tasks.
+
+You would define this role as follows:
+
+ module CalculatingIndividual
+ def some_method_you_want_to_call
+ # some stuff the method does
+ end
+ ...
+ end
+
+That's all there is to it. You can simply wrap another module if you want to.
+We've done this in our scenarios for cukesalad as follows:
+
+ module StepFreeCuker
+ include Aruba::Api
+ end
+
+There are other things you can do, like initialise your 'role' by defining a `role_preparation` method.
+
+Take a look through the examples in this folder.
@@ -0,0 +1,14 @@
+# Defining Tasks
+
+In your scenario, once you've named you role, you can write tasks that use methods on that role.
+For example:
+
+ Given I was able to switch on the calculator
+
+Needs a task called 'switch on the calculator'. You do this by creating a file, usually in `features/tasks`, called `switch_on_the_calculator.rb` with the following:
+
+ in_order_to "switch on the calculator" do
+ switch_on_the_calculator
+ end
+
+This is the most basic example. Look through the other examples to see how to pass arguments into your task.
@@ -0,0 +1,23 @@
+# Expectations
+
+In your scenario, you'll want to express expectations in a number of forms.
+
+The most comprehensive representation of the various ways you can express expectations is in the full set of cukesalad features.
+
+The most basic is as follows:
+
+ Then I should see the answer '10'
+
+For this to work, you need a task that returns a value.
+
+ in_order_to "see the answer" do
+ look_at_the_display
+ end
+
+Your role will need a method called `look_at_the_display` that returns a value.
+
+See the expectations examples for the fundamentals.
+
+See the full set of cukesalad features for examples of the different forms your expectations can take.
+
+All of the cukesalad features use cukesalad to test itself.

0 comments on commit 05695ee

Please sign in to comment.