Skip to content

Commit

Permalink
wrote some basic controller tests for the donors controller. Tested t…
Browse files Browse the repository at this point in the history
…he index and new pages, as well as the happy and unhappy paths for the create page
  • Loading branch information
Erin Joan Snyder authored and Erin Joan Snyder committed Jul 12, 2014
1 parent 5a95cf5 commit 5564644
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 1,266 deletions.
39 changes: 39 additions & 0 deletions spec/controllers/donors_controller_spec.rb
@@ -0,0 +1,39 @@
require 'spec_helper'

describe DonorsController do
context "#index" do
it "should get a 200 response" do
get :index
expect(response.status).to eq 200
end
end

context "#new" do
it "should get a 200 response" do
get :new
expect(response.status).to eq 200
end
end

context "#create" do
it "creates a donor with valid params" do
expect{
Donor.create(name: "Erin", city: "San Francisco", phone_number: "555-555-5555", email: "erin@erin.com", username: "ErinJoan", password: "erinisgreat")
}.to change { Donor.count }.by(1)
end

it "doesn't create a donor when params are left blank" do
expect{
Donor.create(name: "", city: "", phone_number: "", email: "", username: "", password: "")
}.to_not change{ Donor.count }
end

it "doesn't create a second donor when params are not unique" do
expect{
2.times do
Donor.create(name: "Erin", city: "San Francisco", phone_number: "555-555-5555", email: "erin@erin.com", username: "ErinJoan", password: "erinisgreat")
end
}.to change { Donor.count }.by(1)
end
end
end
10 changes: 0 additions & 10 deletions spec/controllers/rooms_spec.rb

This file was deleted.

15 changes: 0 additions & 15 deletions spec/features/chatRoomMVC_features_spec.rb

This file was deleted.

19 changes: 0 additions & 19 deletions spec/features/roomList_features_spec.rb

This file was deleted.

0 comments on commit 5564644

Please sign in to comment.