{"action":"created","comment":{"url":"https://api.github.com/repos/openSUSE/osem/pulls/comments/55099959","id":55099959,"diff_hunk":"@@ -0,0 +1,276 @@\n+require 'spec_helper'\n+\n+describe ConferenceRegistrationsController, type: :controller do\n+  let(:conference) { create(:conference) }\n+  let(:conference_with_open_registration) { create(:conference) }\n+  let!(:open_registration_period) { create(:registration_period, conference: conference_with_open_registration, start_date: Date.current - 6.days) }\n+  let(:user) { create(:user) }\n+\n+  context 'user is signed in' do\n+    before { sign_in(user) }\n+\n+    describe 'GET #new' do\n+      context 'user is registered to conference' do\n+        before do\n+          create(:registration, user: user, conference: conference_with_open_registration)\n+          get :new, conference_id: conference_with_open_registration.short_title\n+        end\n+\n+        it 'redirects to edit registration page' do\n+          expect(response).to redirect_to edit_conference_conference_registrations_path(conference_with_open_registration.short_title)\n+        end\n+      end\n+\n+      context 'ichain is enabled and user is not signed in' do\n+        before do\n+          CONFIG['authentication']['ichain']['enabled'] = true\n+          sign_out user\n+          get :new, conference_id: conference_with_open_registration.short_title\n+        end\n+\n+        after { CONFIG['authentication']['ichain']['enabled'] = false }\n+\n+        it 'redirects to root path' do\n+          expect(response).to redirect_to root_path\n+        end\n+      end\n+\n+      context 'registration limit has reached' do\n+        before do\n+          conference_with_open_registration.update_attributes(registration_limit: 1)\n+          create(:registration, conference: conference_with_open_registration)\n+          get :new, conference_id: conference_with_open_registration.short_title\n+        end\n+\n+        it 'redirects to root path' do\n+          expect(response).to redirect_to root_path\n+        end\n+\n+        it 'shows error in flash message' do\n+          expect(flash[:alert]).to match \"Sorry, registration limit exceeded for #{conference_with_open_registration.title}\"\n+        end\n+      end\n+\n+      context 'successful request' do\n+        before do\n+          get :new, conference_id: conference_with_open_registration.short_title\n+        end\n+\n+        it 'assigns registration and user variables' do\n+          expect(assigns(:registration)).to be_instance_of(Registration)\n+          expect(assigns(:user)).to be_instance_of(User)\n+        end\n+\n+        it 'renders the new template' do\n+          expect(response).to render_template('new')\n+        end\n+      end\n+    end\n+\n+    describe 'GET #show' do\n+      before do\n+        @registration = create(:registration, conference: conference_with_open_registration, user: user)\n+      end\n+\n+      context 'user has purchased a ticket' do\n+        before do\n+          @ticket = create(:ticket, conference: conference_with_open_registration)\n+          @purchased_ticket = create(:ticket_purchase, conference: conference_with_open_registration,\n+                                                       user: user,\n+                                                       ticket: @ticket)\n+          get :show, conference_id: conference_with_open_registration.short_title\n+        end\n+\n+        it 'renders the show template' do\n+          expect(response).to render_template('show')\n+        end\n+\n+        it 'assigns workshops variable' do\n+          expect(assigns(:workshops)).to eq @registration.workshops\n+        end\n+\n+        it 'assigns price of purchased tickets to total_price and purchased tickets to tickets' do\n+          expect(assigns(:total_price)).to eq @ticket.price * @purchased_ticket.quantity","path":"spec/controllers/conference_registration_controller_spec.rb","position":93,"original_position":93,"commit_id":"d8cc4d44e10474983f297ccea4641deb7d37dbea","original_commit_id":"d8cc4d44e10474983f297ccea4641deb7d37dbea","user":{"login":"differentreality","id":4322737,"avatar_url":"https://avatars.githubusercontent.com/u/4322737?v=3","gravatar_id":"","url":"https://api.github.com/users/differentreality","html_url":"https://github.com/differentreality","followers_url":"https://api.github.com/users/differentreality/followers","following_url":"https://api.github.com/users/differentreality/following{/other_user}","gists_url":"https://api.github.com/users/differentreality/gists{/gist_id}","starred_url":"https://api.github.com/users/differentreality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/differentreality/subscriptions","organizations_url":"https://api.github.com/users/differentreality/orgs","repos_url":"https://api.github.com/users/differentreality/repos","events_url":"https://api.github.com/users/differentreality/events{/privacy}","received_events_url":"https://api.github.com/users/differentreality/received_events","type":"User","site_admin":false},"body":"Make it explicit. Instead of the multiplication, simply put the right number here.","created_at":"2016-03-04T22:37:24Z","updated_at":"2016-03-04T22:37:24Z","html_url":"https://github.com/openSUSE/osem/pull/795#discussion_r55099959","pull_request_url":"https://api.github.com/repos/openSUSE/osem/pulls/795","_links":{"self":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/comments/55099959"},"html":{"href":"https://github.com/openSUSE/osem/pull/795#discussion_r55099959"},"pull_request":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/795"}}},"pull_request":{"url":"https://api.github.com/repos/openSUSE/osem/pulls/795","id":60897349,"html_url":"https://github.com/openSUSE/osem/pull/795","diff_url":"https://github.com/openSUSE/osem/pull/795.diff","patch_url":"https://github.com/openSUSE/osem/pull/795.patch","issue_url":"https://api.github.com/repos/openSUSE/osem/issues/795","number":795,"state":"open","locked":false,"title":"Fix authorization of registration controller and add tests","user":{"login":"sonalkr132","id":7680662,"avatar_url":"https://avatars.githubusercontent.com/u/7680662?v=3","gravatar_id":"","url":"https://api.github.com/users/sonalkr132","html_url":"https://github.com/sonalkr132","followers_url":"https://api.github.com/users/sonalkr132/followers","following_url":"https://api.github.com/users/sonalkr132/following{/other_user}","gists_url":"https://api.github.com/users/sonalkr132/gists{/gist_id}","starred_url":"https://api.github.com/users/sonalkr132/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonalkr132/subscriptions","organizations_url":"https://api.github.com/users/sonalkr132/orgs","repos_url":"https://api.github.com/users/sonalkr132/repos","events_url":"https://api.github.com/users/sonalkr132/events{/privacy}","received_events_url":"https://api.github.com/users/sonalkr132/received_events","type":"User","site_admin":false},"body":"Test of new action serves as test of before_filter :registration_period_inclusion.\r\nChange in proposal spec cause conference has to have valid registration\r\nperiod for successful redirect to registration after confirm proposal.\r\n\r\nCloses: #791\r\n\r\nI feel like there is no need of adding validation to model as requests with invalid registration objects (wrt to registration period) won't ever reach registration model. Should I add it anyway?","created_at":"2016-02-26T20:14:33Z","updated_at":"2016-03-04T22:37:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dd38597126fee4b654f5b0f106ceee465cee4c1f","assignee":{"login":"differentreality","id":4322737,"avatar_url":"https://avatars.githubusercontent.com/u/4322737?v=3","gravatar_id":"","url":"https://api.github.com/users/differentreality","html_url":"https://github.com/differentreality","followers_url":"https://api.github.com/users/differentreality/followers","following_url":"https://api.github.com/users/differentreality/following{/other_user}","gists_url":"https://api.github.com/users/differentreality/gists{/gist_id}","starred_url":"https://api.github.com/users/differentreality/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/differentreality/subscriptions","organizations_url":"https://api.github.com/users/differentreality/orgs","repos_url":"https://api.github.com/users/differentreality/repos","events_url":"https://api.github.com/users/differentreality/events{/privacy}","received_events_url":"https://api.github.com/users/differentreality/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/openSUSE/osem/pulls/795/commits","review_comments_url":"https://api.github.com/repos/openSUSE/osem/pulls/795/comments","review_comment_url":"https://api.github.com/repos/openSUSE/osem/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openSUSE/osem/issues/795/comments","statuses_url":"https://api.github.com/repos/openSUSE/osem/statuses/d8cc4d44e10474983f297ccea4641deb7d37dbea","head":{"label":"sonalkr132:registration_period","ref":"registration_period","sha":"d8cc4d44e10474983f297ccea4641deb7d37dbea","user":{"login":"sonalkr132","id":7680662,"avatar_url":"https://avatars.githubusercontent.com/u/7680662?v=3","gravatar_id":"","url":"https://api.github.com/users/sonalkr132","html_url":"https://github.com/sonalkr132","followers_url":"https://api.github.com/users/sonalkr132/followers","following_url":"https://api.github.com/users/sonalkr132/following{/other_user}","gists_url":"https://api.github.com/users/sonalkr132/gists{/gist_id}","starred_url":"https://api.github.com/users/sonalkr132/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonalkr132/subscriptions","organizations_url":"https://api.github.com/users/sonalkr132/orgs","repos_url":"https://api.github.com/users/sonalkr132/repos","events_url":"https://api.github.com/users/sonalkr132/events{/privacy}","received_events_url":"https://api.github.com/users/sonalkr132/received_events","type":"User","site_admin":false},"repo":{"id":31470075,"name":"osem","full_name":"sonalkr132/osem","owner":{"login":"sonalkr132","id":7680662,"avatar_url":"https://avatars.githubusercontent.com/u/7680662?v=3","gravatar_id":"","url":"https://api.github.com/users/sonalkr132","html_url":"https://github.com/sonalkr132","followers_url":"https://api.github.com/users/sonalkr132/followers","following_url":"https://api.github.com/users/sonalkr132/following{/other_user}","gists_url":"https://api.github.com/users/sonalkr132/gists{/gist_id}","starred_url":"https://api.github.com/users/sonalkr132/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonalkr132/subscriptions","organizations_url":"https://api.github.com/users/sonalkr132/orgs","repos_url":"https://api.github.com/users/sonalkr132/repos","events_url":"https://api.github.com/users/sonalkr132/events{/privacy}","received_events_url":"https://api.github.com/users/sonalkr132/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sonalkr132/osem","description":"Open Source Event Manager. An event management tool tailored to Free and Open Source Software conferences.","fork":true,"url":"https://api.github.com/repos/sonalkr132/osem","forks_url":"https://api.github.com/repos/sonalkr132/osem/forks","keys_url":"https://api.github.com/repos/sonalkr132/osem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sonalkr132/osem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sonalkr132/osem/teams","hooks_url":"https://api.github.com/repos/sonalkr132/osem/hooks","issue_events_url":"https://api.github.com/repos/sonalkr132/osem/issues/events{/number}","events_url":"https://api.github.com/repos/sonalkr132/osem/events","assignees_url":"https://api.github.com/repos/sonalkr132/osem/assignees{/user}","branches_url":"https://api.github.com/repos/sonalkr132/osem/branches{/branch}","tags_url":"https://api.github.com/repos/sonalkr132/osem/tags","blobs_url":"https://api.github.com/repos/sonalkr132/osem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sonalkr132/osem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sonalkr132/osem/git/refs{/sha}","trees_url":"https://api.github.com/repos/sonalkr132/osem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sonalkr132/osem/statuses/{sha}","languages_url":"https://api.github.com/repos/sonalkr132/osem/languages","stargazers_url":"https://api.github.com/repos/sonalkr132/osem/stargazers","contributors_url":"https://api.github.com/repos/sonalkr132/osem/contributors","subscribers_url":"https://api.github.com/repos/sonalkr132/osem/subscribers","subscription_url":"https://api.github.com/repos/sonalkr132/osem/subscription","commits_url":"https://api.github.com/repos/sonalkr132/osem/commits{/sha}","git_commits_url":"https://api.github.com/repos/sonalkr132/osem/git/commits{/sha}","comments_url":"https://api.github.com/repos/sonalkr132/osem/comments{/number}","issue_comment_url":"https://api.github.com/repos/sonalkr132/osem/issues/comments{/number}","contents_url":"https://api.github.com/repos/sonalkr132/osem/contents/{+path}","compare_url":"https://api.github.com/repos/sonalkr132/osem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sonalkr132/osem/merges","archive_url":"https://api.github.com/repos/sonalkr132/osem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sonalkr132/osem/downloads","issues_url":"https://api.github.com/repos/sonalkr132/osem/issues{/number}","pulls_url":"https://api.github.com/repos/sonalkr132/osem/pulls{/number}","milestones_url":"https://api.github.com/repos/sonalkr132/osem/milestones{/number}","notifications_url":"https://api.github.com/repos/sonalkr132/osem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sonalkr132/osem/labels{/name}","releases_url":"https://api.github.com/repos/sonalkr132/osem/releases{/id}","deployments_url":"https://api.github.com/repos/sonalkr132/osem/deployments","created_at":"2015-02-28T17:30:19Z","updated_at":"2016-02-18T05:57:21Z","pushed_at":"2016-03-04T17:55:36Z","git_url":"git://github.com/sonalkr132/osem.git","ssh_url":"git@github.com:sonalkr132/osem.git","clone_url":"https://github.com/sonalkr132/osem.git","svn_url":"https://github.com/sonalkr132/osem","homepage":"http://osem.io","size":20790,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openSUSE:master","ref":"master","sha":"eda5c2bc07b49d183feffce4339c1f079097434d","user":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"repo":{"id":5911225,"name":"osem","full_name":"openSUSE/osem","owner":{"login":"openSUSE","id":623819,"avatar_url":"https://avatars.githubusercontent.com/u/623819?v=3","gravatar_id":"","url":"https://api.github.com/users/openSUSE","html_url":"https://github.com/openSUSE","followers_url":"https://api.github.com/users/openSUSE/followers","following_url":"https://api.github.com/users/openSUSE/following{/other_user}","gists_url":"https://api.github.com/users/openSUSE/gists{/gist_id}","starred_url":"https://api.github.com/users/openSUSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openSUSE/subscriptions","organizations_url":"https://api.github.com/users/openSUSE/orgs","repos_url":"https://api.github.com/users/openSUSE/repos","events_url":"https://api.github.com/users/openSUSE/events{/privacy}","received_events_url":"https://api.github.com/users/openSUSE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openSUSE/osem","description":"Open Source Event Manager. An event management tool tailored to Free and Open Source Software conferences.","fork":false,"url":"https://api.github.com/repos/openSUSE/osem","forks_url":"https://api.github.com/repos/openSUSE/osem/forks","keys_url":"https://api.github.com/repos/openSUSE/osem/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openSUSE/osem/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openSUSE/osem/teams","hooks_url":"https://api.github.com/repos/openSUSE/osem/hooks","issue_events_url":"https://api.github.com/repos/openSUSE/osem/issues/events{/number}","events_url":"https://api.github.com/repos/openSUSE/osem/events","assignees_url":"https://api.github.com/repos/openSUSE/osem/assignees{/user}","branches_url":"https://api.github.com/repos/openSUSE/osem/branches{/branch}","tags_url":"https://api.github.com/repos/openSUSE/osem/tags","blobs_url":"https://api.github.com/repos/openSUSE/osem/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openSUSE/osem/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openSUSE/osem/git/refs{/sha}","trees_url":"https://api.github.com/repos/openSUSE/osem/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openSUSE/osem/statuses/{sha}","languages_url":"https://api.github.com/repos/openSUSE/osem/languages","stargazers_url":"https://api.github.com/repos/openSUSE/osem/stargazers","contributors_url":"https://api.github.com/repos/openSUSE/osem/contributors","subscribers_url":"https://api.github.com/repos/openSUSE/osem/subscribers","subscription_url":"https://api.github.com/repos/openSUSE/osem/subscription","commits_url":"https://api.github.com/repos/openSUSE/osem/commits{/sha}","git_commits_url":"https://api.github.com/repos/openSUSE/osem/git/commits{/sha}","comments_url":"https://api.github.com/repos/openSUSE/osem/comments{/number}","issue_comment_url":"https://api.github.com/repos/openSUSE/osem/issues/comments{/number}","contents_url":"https://api.github.com/repos/openSUSE/osem/contents/{+path}","compare_url":"https://api.github.com/repos/openSUSE/osem/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openSUSE/osem/merges","archive_url":"https://api.github.com/repos/openSUSE/osem/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openSUSE/osem/downloads","issues_url":"https://api.github.com/repos/openSUSE/osem/issues{/number}","pulls_url":"https://api.github.com/repos/openSUSE/osem/pulls{/number}","milestones_url":"https://api.github.com/repos/openSUSE/osem/milestones{/number}","notifications_url":"https://api.github.com/repos/openSUSE/osem/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openSUSE/osem/labels{/name}","releases_url":"https://api.github.com/repos/openSUSE/osem/releases{/id}","deployments_url":"https://api.github.com/repos/openSUSE/osem/deployments","created_at":"2012-09-22T07:40:18Z","updated_at":"2016-03-04T04:11:38Z","pushed_at":"2016-03-04T21:59:36Z","git_url":"git://github.com/openSUSE/osem.git","ssh_url":"git@github.com:openSUSE/osem.git","clone_url":"https://github.com/openSUSE/osem.git","svn_url":"https://github.com/openSUSE/osem","homepage":"http://osem.io","size":21571,"stargazers_count":105,"watchers_count":105,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":76,"mirror_url":null,"open_issues_count":103,"forks":76,"open_issues":103,"watchers":105,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/795"},"html":{"href":"https://github.com/openSUSE/osem/pull/795"},"issue":{"href":"https://api.github.com/repos/openSUSE/osem/issues/795"},"comments":{"href":"https://api.github.com/repos/openSUSE/osem/issues/795/comments"},"review_comments":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/795/comments"},"review_comment":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openSUSE/osem/pulls/795/commits"},"statuses":{"href":"https://api.github.com/repos/openSUSE/osem/statuses/d8cc4d44e10474983f297ccea4641deb7d37dbea"}}}}