forked from beautyjoy/BJC-Teacher-Tracker
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from tommywei110/177587453-migrate_test_to_spec
Relocated singular test from test to spec
- Loading branch information
Showing
7 changed files
with
51 additions
and
156 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe TeachersController, type: :controller do | ||
fixtures :all | ||
it "rejects invalid signup information" do | ||
previous_count = Teacher.count | ||
post :create, { | ||
params: { | ||
school: { | ||
name: "invalid", | ||
city: "Berkeley", | ||
state: "CA", | ||
website: "invalid.com" | ||
}, | ||
teacher: { | ||
first_name: "", | ||
last_name: "invalid", | ||
email: "[email protected]", | ||
status: "invalid", | ||
snap: "invalid" | ||
} | ||
} | ||
} | ||
expect(Teacher.count).to eq(previous_count) | ||
assert_match(/First name can't be blank/, flash[:alert]) | ||
end | ||
|
||
|
||
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" | ||
}, | ||
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 | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.