Skip to content

Commit

Permalink
Merge pull request #35 from tommywei110/177587453-migrate_test_to_spec
Browse files Browse the repository at this point in the history
Relocated singular test from test to spec
  • Loading branch information
cscoder42 authored Apr 10, 2021
2 parents 716dd08 + 20b9e8c commit a33a08a
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 156 deletions.
51 changes: 51 additions & 0 deletions spec/teachers_signup_test.rb
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
33 changes: 0 additions & 33 deletions test/fixtures/schools.yml

This file was deleted.

51 changes: 0 additions & 51 deletions test/fixtures/teachers.yml

This file was deleted.

47 changes: 0 additions & 47 deletions test/integration/teachers_signup_test.rb

This file was deleted.

4 changes: 0 additions & 4 deletions test/mailers/previews/teacher_mailer_preview.rb

This file was deleted.

7 changes: 0 additions & 7 deletions test/mailers/teacher_mailer_test.rb

This file was deleted.

14 changes: 0 additions & 14 deletions test/test_helper.rb

This file was deleted.

0 comments on commit a33a08a

Please sign in to comment.