File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11require 'test_helper'
22
33class NewThreadFollowerTest < ActiveSupport ::TestCase
4- # test 'the truth' do
5- # assert true
6- # end
4+ test "save succeeds with user and post" do
5+ new_thread_follower = NewThreadFollower . new
6+ new_thread_follower . user = users ( :basic_user )
7+ new_thread_follower . post = posts ( :question_one )
8+ assert new_thread_follower . save
9+ end
10+
11+ test "save fails without user" do
12+ new_thread_follower = NewThreadFollower . new
13+ new_thread_follower . post = posts ( :question_one )
14+ assert_not new_thread_follower . save
15+ end
16+
17+ test "save fails without post" do
18+ new_thread_follower = NewThreadFollower . new
19+ new_thread_follower . user = users ( :basic_user )
20+ assert_not new_thread_follower . save
21+ end
722end
Original file line number Diff line number Diff line change 11require 'test_helper'
22
33class ThreadFollowerTest < ActiveSupport ::TestCase
4- # test "the truth" do
5- # assert true
6- # end
4+ test "save succeeds with user and thread" do
5+ new_thread_follower = ThreadFollower . new
6+ new_thread_follower . user = users ( :basic_user )
7+ new_thread_follower . comment_thread = comment_threads ( :normal )
8+ assert new_thread_follower . save
9+ end
10+
11+ test "save fails without user" do
12+ new_thread_follower = ThreadFollower . new
13+ new_thread_follower . comment_thread = comment_threads ( :normal )
14+ assert_not new_thread_follower . save
15+ end
16+
17+ test "save fails without thread" do
18+ new_thread_follower = ThreadFollower . new
19+ new_thread_follower . user = users ( :basic_user )
20+ assert_not new_thread_follower . save
21+ end
722end
You can’t perform that action at this time.
0 commit comments