@@ -13,33 +13,34 @@ https://github.com/LRDesign/two-step )
13
13
One excellent example is web site integration tests. With RSpec steps you can
14
14
do:
15
15
16
- steps "Login and change password" do
17
- it "should show the login form" do
18
- visit root
19
- page.should have_text "Login"
20
- end
21
-
22
- it "should successfully log in" do
23
- fill_in :name, "Johnny User"
24
- click "Login"
25
- page.should have_text "Welcome, Johnny!"
26
- end
27
-
28
- it "should load the password change form" do
29
- click "My Settings"
30
- click "Update Password"
31
- page.should have_selector("form#update_password")
32
- end
33
-
34
- it "should change the user's password successfully" do
35
- fill_in :password, "foobar"
36
- fill_in :password_confirmation, "foobar"
37
- click "Change Password"
38
- page.should have_text "Password changed successfully!"
39
- User.find_by_name("Johnny User").valid_password?("foobar").should be_true
40
- end
41
-
42
- end
16
+ ```ruby
17
+ RSpec::Steps.steps "Login and change password" do
18
+ it "should show the login form" do
19
+ visit root
20
+ page.should have_text "Login"
21
+ end
22
+
23
+ it "should successfully log in" do
24
+ fill_in :name, "Johnny User"
25
+ click "Login"
26
+ page.should have_text "Welcome, Johnny!"
27
+ end
28
+
29
+ it "should load the password change form" do
30
+ click "My Settings"
31
+ click "Update Password"
32
+ page.should have_selector("form#update_password")
33
+ end
34
+
35
+ it "should change the user's password successfully" do
36
+ fill_in :password, "foobar"
37
+ fill_in :password_confirmation, "foobar"
38
+ click "Change Password"
39
+ page.should have_text "Password changed successfully!"
40
+ User.find_by_name("Johnny User").valid_password?("foobar").should be_true
41
+ end
42
+ end
43
+ ```
43
44
44
45
The examples above will be run in order. State is preserved between examples
45
46
inside a "steps" block: any DB transactions will not roll back until the entire
@@ -74,7 +75,7 @@ As of 2.0, Steps no longer automatically adds its DSL to the top level. If you
74
75
want that behavior (especially if you're updating an older project) add:
75
76
76
77
```
77
- require 'rspec-steps/monkeypatch '
78
+ require 'rspec-steps/monkeypatching '
78
79
```
79
80
to e.g. `spec_helper.rb.`
80
81
0 commit comments