require'spec_helper'describeInvitesControllerdolet(:token){'123456'}let(:user){create(:user)}let(:member){create(:project_member,invite_token: token,invite_email: 'test@abc.com',user: user)}beforedocontroller.instance_variable_set(:@member,member)sign_in(user)enddescribe'GET #accept'doit'accepts user'doget:accept,id: tokenmember.reloadexpect(response.status).toeq(302)expect(member.user).toeq(user)expect(flash[:notice]).toinclude'You have been granted'endenddescribe'GET #decline'doit'declines user'doget:decline,id: tokenexpect{member.reload}.toraise_errorActiveRecord::RecordNotFoundexpect(response.status).toeq(302)expect(flash[:notice]).toinclude'You have declined the invitation to join'endendend