Skip to content

Commit 0e51aac

Browse files
Merge pull request #25 from learn-co-curriculum/edit-tests-and-readme
edited readme for accuracy on Capybara, uppercased Submit in tests
2 parents 9b8b94d + ef0068d commit 0e51aac

2 files changed

Lines changed: 32 additions & 29 deletions

File tree

README.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Overview
44

55
In this lab, you'll practice building forms in Sinatra by creating a basketball
6-
team sign-up sheet. Your application will have a basic html form, and will
6+
team sign-up sheet. Your application will have a basic HTML form, and will
77
display the data from the form after it has been submitted by the user.
88

99
## Instructions
@@ -15,24 +15,26 @@ display the data from the form after it has been submitted by the user.
1515
3. Make a form
1616

1717
Create a route that responds to a GET request at `/newteam`.
18-
Add a form to the `newteam.erb` template and render it in the GET `/newteam` route.
18+
Add a form to the `newteam.erb` template and render it in the GET `/newteam`
19+
route.
20+
1921
The form should have fields for:
20-
Team name ('name')
21-
Coach ('coach')
22-
Point Guard ('pg')
23-
Shooting Guard ('sg')
24-
Power Forward ('pf')
25-
Small Forward ('sf')
26-
Center ('c')
22+
Team name ('name')
23+
Coach ('coach')
24+
Point Guard ('pg')
25+
Shooting Guard ('sg')
26+
Power Forward ('pf')
27+
Small Forward ('sf')
28+
Center ('c')
2729

28-
It should look something like this:
30+
It should look something like this:
2931

30-
![form for basketball team](https://curriculum-content.s3.amazonaws.com/web-development/Sinatra/basketball-form.png)
32+
![form for basketball team](https://curriculum-content.s3.amazonaws.com/web-development/Sinatra/basketball-form.png)
3133

32-
When creating your form, your "Submit" button will need to be identified by
33-
either an `id` attribute or a `name` attribute with value of "Submit". We're
34-
telling this to you now because our test frame work, Capybara, requires buttons
35-
to be [findable either by an `id` or `name` attribute][capybara-click_button].
34+
When creating your form, your "Submit" button will need to be identified by an
35+
`id` attribute attribute with value of "Submit". We're telling this to you now
36+
because our test frame work, Capybara, requires buttons to be
37+
[findable by an `id`, `title`, or `value` attribute][capybara-click_button].
3638

3739
4. Handle form submission
3840

@@ -42,22 +44,23 @@ display the data from the form after it has been submitted by the user.
4244

4345
5. Final Output
4446

45-
Update the `team.erb` template so when you post to this form, it displays the name of the team and each member of the team.
47+
Update the `team.erb` template so when you post to this form, it displays
48+
the name of the team and each member of the team.
4649

4750
Your view should display something like this:
4851

4952
![completed form](https://curriculum-content.s3.amazonaws.com/web-development/Sinatra/basketball-results.png)
5053

5154
6. Deliverables
5255

53-
Pass the tests! Make sure you read the test output carefully!
56+
Pass the tests! Make sure you read the test output carefully!
5457

5558
## Resources
5659

5760
* [Ashley William's GitHub](https://github.com/ashleygwilliams/) - [Sinatra Form Party](https://github.com/ashleygwilliams/sinatra-form-party)
5861

5962
* [Ashley William's GitHub](https://github.com/ashleygwilliams/) - [Citibike Sinatra](https://github.com/ashleygwilliams/citibike-sinatra)
6063

61-
<p data-visibility='hidden'>View <a href='https://learn.co/lessons/basic-sinatra-forms-lab' title='Sinatara Forms Lab'>Sinatara Forms Lab</a> on Learn.co and start learning to code for free.</p>
62-
6364
[capybara-click_button]: http://www.rubydoc.info/gems/capybara/Capybara%2FNode%2FActions%3Aclick_button
65+
66+
<p data-visibility='hidden'>View <a href='https://learn.co/lessons/basic-sinatra-forms-lab' title='Sinatara Forms Lab'>Sinatara Forms Lab</a> on Learn.co and start learning to code for free.</p>

spec/basic_sinatra_forms_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
expect(last_response.status).to eq(200)
77
end
88

9-
it 'renders basketball team form' do
9+
it 'renders basketball team form' do
1010
visit '/newteam'
1111
expect(page).to have_selector("form")
1212
expect(page).to have_field(:name)
@@ -23,23 +23,23 @@
2323
it 'does not return Sinatra error page' do
2424
visit '/newteam'
2525

26-
click_button "submit"
26+
click_button "Submit"
2727
expect(page).to_not have_text("Backtrace")
2828
end
2929

30-
it "displays the basketball team name in the browser" do
30+
it "displays the basketball team name in the browser" do
3131
visit '/newteam'
3232

3333
fill_in(:name, :with => "Bballers")
34-
click_button "submit"
34+
click_button "Submit"
3535
expect(page).to have_text("Team Name: Bballers")
3636
end
3737

3838
it "displays the coach's name in the browser" do
3939
visit '/newteam'
4040

4141
fill_in(:coach, :with => "Walter")
42-
click_button "submit"
42+
click_button "Submit"
4343

4444
expect(page).to have_text("Coach: Walter")
4545
end
@@ -48,7 +48,7 @@
4848
visit '/newteam'
4949

5050
fill_in(:pg, :with => "Jeff")
51-
click_button "submit"
51+
click_button "Submit"
5252

5353
expect(page).to have_text("Point Guard: Jeff")
5454
end
@@ -57,7 +57,7 @@
5757
visit '/newteam'
5858

5959
fill_in(:sg, :with => "Ralph")
60-
click_button "submit"
60+
click_button "Submit"
6161

6262
expect(page).to have_text("Shooting Guard: Ralph")
6363
end
@@ -66,7 +66,7 @@
6666
visit '/newteam'
6767

6868
fill_in(:pf, :with => "Danny")
69-
click_button "submit"
69+
click_button "Submit"
7070

7171
expect(page).to have_text("Power Forward: Danny")
7272
end
@@ -75,7 +75,7 @@
7575
visit '/newteam'
7676

7777
fill_in(:sg, :with => "Joe")
78-
click_button "submit"
78+
click_button "Submit"
7979

8080
expect(page).to have_text("Shooting Guard: Joe")
8181
end
@@ -84,7 +84,7 @@
8484
visit '/newteam'
8585

8686
fill_in(:c, :with => "Avi")
87-
click_button "submit"
87+
click_button "Submit"
8888

8989
expect(page).to have_text("Center: Avi")
9090
end

0 commit comments

Comments
 (0)