diff options
author | Stan Hu <stanhu@gmail.com> | 2015-10-20 10:28:28 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-10-20 17:45:48 +0300 |
commit | 9bfc531ec611d108c45af239a1e5e016b892231b (patch) | |
tree | d7aa71396441ec2014a1c63558fb9889854aeae8 /spec/controllers/invites_controller_spec.rb | |
parent | 97eafd4b3dbc186fc3d633c20a7e364ebf31849d (diff) |
Redirect to a default path if HTTP_REFERER is not set
Safari 9.0 does not yet honor the HTML5 `origin-when-cross-origin` mode,
and it's possible load balancers/proxies strip the HTTP_REFERER from
the request header. In these cases, default to some default path.
Closes #3122
Closes https://github.com/gitlabhq/gitlabhq/issues/9731
Diffstat (limited to 'spec/controllers/invites_controller_spec.rb')
-rw-r--r-- | spec/controllers/invites_controller_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb new file mode 100644 index 00000000000..3c6e54839b5 --- /dev/null +++ b/spec/controllers/invites_controller_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe InvitesController do + let(:token) { '123456' } + let(:user) { create(:user) } + let(:member) { create(:project_member, invite_token: token, invite_email: 'test@abc.com', user: user) } + + before do + controller.instance_variable_set(:@member, member) + sign_in(user) + end + + describe 'GET #accept' do + it 'accepts user' do + get :accept, id: token + member.reload + + expect(response.status).to eq(302) + expect(member.user).to eq(user) + expect(flash[:notice]).to include 'You have been granted' + end + end + + describe 'GET #decline' do + it 'declines user' do + get :decline, id: token + expect{member.reload}.to raise_error ActiveRecord::RecordNotFound + + expect(response.status).to eq(302) + expect(flash[:notice]).to include 'You have declined the invitation to join' + end + end +end |