-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
762b7c4
commit c4cc1d9
Showing
1 changed file
with
30 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,17 +29,17 @@ | |
it "rejects invalid signup school information" do | ||
previous_count = Teacher.count | ||
post :create, params: { | ||
school: { | ||
city: "Berkeley", | ||
state: "CA", | ||
}, | ||
teacher: { | ||
first_name: "invalid", | ||
last_name: "invalid", | ||
email: "[email protected]", | ||
status: "invalid", | ||
snap: "invalid" | ||
} | ||
school: { | ||
city: "Berkeley", | ||
state: "CA", | ||
}, | ||
teacher: { | ||
first_name: "invalid", | ||
last_name: "invalid", | ||
email: "[email protected]", | ||
status: "invalid", | ||
snap: "invalid" | ||
} | ||
} | ||
expect(Teacher.count).to eq(previous_count) | ||
expect(flash[:alert]).to match(/An error occurred/) | ||
|
@@ -48,32 +48,32 @@ | |
it "accepts valid signup information" do | ||
previous_count = Teacher.count | ||
post :create, params: { | ||
school: { | ||
name: "valid_example", | ||
city: "Berkeley", | ||
state: "CA", | ||
website: "valid_example.com", | ||
school_type: "Public", | ||
grade_level: "High School" | ||
}, | ||
teacher: { | ||
first_name: "valid_example", | ||
last_name: "valid_example", | ||
email: "valid_example@valid_example.edu", | ||
status: 0, | ||
snap: "valid_example" | ||
} | ||
school: { | ||
name: "valid_example", | ||
city: "Berkeley", | ||
state: "CA", | ||
website: "valid_example.com", | ||
school_type: "Public", | ||
grade_level: "High School" | ||
}, | ||
teacher: { | ||
first_name: "valid_example", | ||
last_name: "valid_example", | ||
email: "valid_example@valid_example.edu", | ||
status: 0, | ||
snap: "valid_example" | ||
} | ||
} | ||
expect(Teacher.count).to eq(previous_count + 1) | ||
assert_match(/Thanks for signing up for BJC/, flash[:success]) | ||
end | ||
|
||
it "redirects existing users to the login page" do | ||
post :create, params: { | ||
school: { | ||
id: 1 | ||
}, | ||
teacher: Teacher.first.attributes | ||
school: { | ||
id: 1 | ||
}, | ||
teacher: Teacher.first.attributes | ||
} | ||
expect(response).to redirect_to(login_path) | ||
expect(flash[:notice]).to match(/Please log in/) | ||
|