Skip to content

Commit b2b66f1

Browse files
committed
Merge pull request #3 from learn-co-curriculum/wip
Wip
2 parents 01c6e5b + 8a08366 commit b2b66f1

3 files changed

Lines changed: 98 additions & 43 deletions

File tree

CONTRIBUTING.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Contributing to Learn.co Curriculum
2+
3+
We're really exited that you're about to contribute to the [open curriculum](https://learn.co/content-license) on [Learn.co](https://learn.co). If this is your first time contributing, please continue reading to learn how to make the most meaningful and useful impact possible.
4+
5+
## Raising an Issue to Encourage a Contribution
6+
7+
If you notice a problem with the curriculum that you believe needs improvement
8+
but you're unable to make the change yourself, you should raise a Github issue
9+
containing a clear description of the problem. Include relevant snippets of
10+
the content and/or screenshots if applicable. Curriculum owners regularly review
11+
issue lists and your issue will be prioritized and addressed as appropriate.
12+
13+
## Submitting a Pull Request to Suggest an Improvement
14+
15+
If you see an opportunity for improvement and can make the change yourself go
16+
ahead and use a typical git workflow to make it happen:
17+
18+
* Fork this curriculum repository
19+
* Make the change on your fork, with descriptive commits in the standard format
20+
* Open a Pull Request against this repo
21+
22+
A curriculum owner will review your change and approve or comment on it in due
23+
course.
24+
25+
# Why Contribute?
26+
27+
Curriculum on Learn is publicly and freely available under Learn's
28+
[Educational Content License](https://learn.co/content-license). By
29+
embracing an open-source contribution model, our goal is for the curriculum
30+
on Learn to become, in time, the best educational content the world has
31+
ever seen.
32+
33+
We need help from the community of Learners to maintain and improve the
34+
educational content. Everything from fixing typos, to correcting
35+
out-dated information, to improving exposition, to adding better examples,
36+
to fixing tests—all contributions to making the curriculum more effective are
37+
welcome.

spec/models/puppy_spec.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
describe 'Puppy class' do
2+
let!(:puppy) { Puppy.new("brad", "black lab", 2) }
3+
4+
it 'can create a new instance of the puppy class' do
5+
expect(Puppy.new("brad", "black lab", 2)).to be_an_instance_of(Puppy)
6+
end
7+
8+
it 'can read a puppy name' do
9+
expect(puppy.name).to eq("brad")
10+
end
11+
12+
it 'can read a puppy breed' do
13+
expect(puppy.name).to eq("black lab")
14+
end
15+
16+
it 'can read a puppy age' do
17+
expect(puppy.name).to eq(2)
18+
end
19+
20+
it 'can change puppy age' do
21+
puppy.age = 3
22+
expect(puppy.age).to eq(3)
23+
end
24+
25+
it 'can change puppy name' do
26+
puppy.name = "brad the beast"
27+
expect(puppy.name).to eq("brad the beast")
28+
end
29+
30+
it 'can change puppy breed' do
31+
puppy.breed = "the best black lab"
32+
expect(puppy.breed).to eq("the best black lab")
33+
end
34+
end
Lines changed: 27 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,46 @@
1+
describe App do
12

2-
require 'pry'
3-
describe "Puppy Adoption Site" do
4-
describe "GET '/'" do
5-
before(:each) do
3+
describe 'GET /' do
4+
5+
it 'sends a 200 status code' do
66
get '/'
7-
end
8-
9-
it "returns a 200 status code" do
107
expect(last_response.status).to eq(200)
118
end
129

13-
it "renders a welcome" do
14-
expect(last_response.body).to include("Welcome to the puppy adoption site!")
15-
expect(last_response.body).to include("Click Here To List A Puppy")
10+
it 'renders welcome' do
11+
visit '/'
12+
expect(page).to have_link("Click Here To List A Puppy")
1613
end
1714
end
1815

19-
describe "GET '/new'" do
20-
before(:each) do
21-
get '/new'
22-
end
23-
24-
it "returns a 200 status code" do
16+
describe 'GET /NEW' do
17+
it 'sends a 200 status code' do
18+
get '/'
2519
expect(last_response.status).to eq(200)
2620
end
2721

28-
it "renders a new form element on the page" do
29-
expect(last_response.body).to include("<form")
30-
expect(last_response.body).to include("</form>")
31-
end
32-
33-
it "renders the puppy input fields for name, breed, and age attributes on the page" do
34-
# binding.pry
35-
expect(last_response.body).to include("name")
36-
expect(last_response.body).to include("breed")
37-
expect(last_response.body).to include("age")
22+
it 'renders the form' do
23+
visit '/new'
24+
expect(page).to have_selector("form")
25+
expect(page).to have_field(:name)
26+
expect(page).to have_field(:breed)
27+
expect(page).to have_field(:age)
3828
end
3929
end
4030

41-
describe "POST '/puppy'" do
42-
before do
43-
post '/puppy', {
44-
"name"=>"Ian",
45-
"breed"=>"Dalmation",
46-
"age"=>"6",
47-
}
48-
end
49-
50-
it "returns a 200 status code" do
51-
expect(last_response.status).to eq(200)
52-
end
31+
describe 'POST /' do
32+
it "displays the puppy" do
33+
visit '/new'
5334

54-
it "displays the puppy information upon form submission" do
55-
expect(last_response.body).to include("Ian")
56-
expect(last_response.body).to include("Dalmation")
57-
expect(last_response.body).to include("6")
35+
fill_in(:name, :with => "Butch")
36+
fill_in(:breed, :with => "Mastiff")
37+
fill_in(:age, :with => "6 months")
38+
click_button "submit"
39+
expect(page).to have_text("Puppy Name:\nButch")
40+
expect(page).to have_text("Puppy Breed:\nMastiff")
41+
expect(page).to have_text("Puppy Age:\n6 months")
5842
end
43+
end
5944

6045

61-
end
6246
end

0 commit comments

Comments
 (0)