/
capybara_javascript_drivers.feature
87 lines (72 loc) · 2.37 KB
/
capybara_javascript_drivers.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Feature: Capybara Javascript Drivers
Background: A simple calendar app
Given I have created a new Rails 3 app "rails-3-app" with cucumber-rails support
And I successfully run `bundle exec rails g scaffold appointment name:string when:datetime`
Scenario Outline: Use a particular driver
Given I write to "features/create_appointment.feature" with:
"""
@javascript
Feature: Create appointments
Scenario: Constitution on May 17
Given I am on the new appointment page
And I fill in "Norway's constitution" for "Name"
And I select "2009-02-20 15:10:00 UTC" as the "When" date and time
And I press "Create Appointment"
Then I should see "Norway's constitution"
And I should see "2009-02-20 15:10:00 UTC"
"""
And I append to "Gemfile" with:
"""
<Gemfile extra>
"""
And I append to "features/support/env.rb" with:
"""
<env.rb extra>
"""
When I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then it should pass with:
"""
1 scenario (1 passed)
6 steps (6 passed)
"""
Examples:
| Gemfile extra | env.rb extra |
| '' | '' |
Scenario Outline: Mixed DB access
Given I write to "features/create_appointment.feature" with:
"""
@javascript
Feature: Create appointments
Scenario: Constitution on May 17
Given a random appointment
And I am viewing random appointment
Then I should see "Random appointment"
"""
And I write to "features/step_definitions/custom_steps.rb" with:
"""
Given /^a random appointment$/ do
@appointment = Appointment.create!(:name => 'Random appointment', :when => DateTime.now)
end
Given /^I am viewing random appointment$/ do
visit appointment_path(@appointment)
end
"""
And I append to "Gemfile" with:
"""
<Gemfile extra>
"""
And I append to "features/support/env.rb" with:
"""
<env.rb extra>
"""
When I run `bundle exec rake db:migrate`
And I run `bundle exec rake cucumber`
Then it should pass with:
"""
1 scenario (1 passed)
3 steps (3 passed)
"""
Examples:
| Gemfile extra | env.rb extra |
| '' | '' |