Guest User

Untitled

a guest
Mar 11th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.67 KB | None | 0 0
  1. class UserFriendshipsControllerTest < ActionController::TestCase
  2. context "#new" do
  3.     context "when not logged in" do
  4.         should "redirect to the login page" do
  5.             get :new assert_response :redirect
  6.         end
  7.     end
  8.     context "when logged in" do
  9.         setup do
  10.             sign_in users(:allan)
  11.         end
  12.         should "get new and return success" do
  13.             get :new assert_response :success
  14.         end
  15.         should "should set a flash error if the friend_id params is missing" do
  16.             get :new, {} assert_equal "Friend required", flash[:error]
  17.         end
  18.         should "display friends name" do
  19.             get :new, friend_id: users(:drew).id assert_match /#{users(:drew).full_name}/, response.body
  20.         end
  21.     end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment