Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserFriendshipsControllerTest < ActionController::TestCase
- context "#new" do
- context "when not logged in" do
- should "redirect to the login page" do
- get :new assert_response :redirect
- end
- end
- context "when logged in" do
- setup do
- sign_in users(:allan)
- end
- should "get new and return success" do
- get :new assert_response :success
- end
- should "should set a flash error if the friend_id params is missing" do
- get :new, {} assert_equal "Friend required", flash[:error]
- end
- should "display friends name" do
- get :new, friend_id: users(:drew).id assert_match /#{users(:drew).full_name}/, response.body
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment