{"action":"created","comment":{"url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments/26815567","id":26815567,"diff_hunk":"@@ -0,0 +1,203 @@\n+require 'spec_helper'\n+\n+describe GradeEntryFormsController do\n+  before :each do\n+    # Authenticate user is not timed out, and has administrator rights.\n+    allow(controller).to receive(:session_expired?).and_return(false)\n+    allow(controller).to receive(:logged_in?).and_return(true)\n+    allow(controller).to receive(:current_user).and_return(build(:admin))\n+  end\n+\n+  let(:grade_entry_form) { create(:grade_entry_form) }\n+  let(:grade_entry_form_with_data) { create(:grade_entry_form_with_data) }\n+\n+  context 'CSV_Uploads' do\n+    before :each do\n+      @file_without_extension =\n+        fixture_file_upload('spec/fixtures/files/grade_entry_upload_empty_file',\n+                            'text/xml')\n+      @file_wrong_format =\n+        fixture_file_upload(\n+          'spec/fixtures/files/grade_entry_upload_wrong_format.xls', 'text/xls')\n+      @file_bad_csv =\n+        fixture_file_upload(\n+          'spec/fixtures/files/grade_entry_upload_bad_csv.csv', 'text/xls')\n+      @file_non_empty_first_cell =\n+        fixture_file_upload(\n+          'spec/fixtures/files/grade_entry_upload_non_empty_first_cell.csv',\n+          'text/csv')\n+      @file_invalid_username =\n+        fixture_file_upload(\n+          'spec/fixtures/files/grade_entry_form_invalid_username.csv',\n+          'text/csv')\n+      @file_extra_column =\n+        fixture_file_upload(\n+          'spec/fixtures/files/grade_entry_form_extra_column.csv',\n+          'text/csv')\n+      @file_wrong_column_name =\n+        fixture_file_upload(\n+          'spec/fixtures/files/grade_entry_form_wrong_column_name.csv',\n+          'text/csv')\n+      @file_wrong_total =\n+        fixture_file_upload(\n+          'spec/fixtures/files/grade_entry_form_wrong_total.csv',\n+          'text/csv')\n+      @file_good =\n+        fixture_file_upload(\n+          'spec/fixtures/files/grade_entry_form_good.csv',\n+          'text/csv')\n+        \n+    end\n+    \n+    it 'accepts valid file' do\n+      post :csv_upload,\n+        id: grade_entry_form_with_data,\n+        upload: { grades_file: @file_good }\n+      expect(response.status).to eq(302)\n+      expect(flash[:error]).to be_nil\n+      expect(response).to redirect_to(\n+        grades_grade_entry_form_path(grade_entry_form_with_data, locale: 'en'))\n+    end\n+    \n+    it 'does not accept csv file with an invalid username' do\n+      post :csv_upload,\n+        id: grade_entry_form_with_data,\n+        upload: { grades_file: @file_invalid_username }\n+      expect(response.status).to eq(302)\n+      expect(flash[:error]).to_not be_empty\n+      puts flash[:error]\n+      expect(response).to redirect_to(\n+        grades_grade_entry_form_path(grade_entry_form_with_data, locale: 'en'))\n+    end\n+    \n+    it 'does not accept files with additional columns' do\n+      post :csv_upload,\n+        id: grade_entry_form_with_data,\n+        upload: { grades_file: @file_extra_column }\n+      expect(response.status).to eq(302)\n+      expect(flash[:error]).to_not be_empty\n+      puts flash[:error]\n+      expect(response).to redirect_to(\n+        grades_grade_entry_form_path(grade_entry_form_with_data, locale: 'en'))\n+    end\n+    \n+    it 'does not accept files with wrong column name' do\n+      post :csv_upload,\n+        id: grade_entry_form_with_data,\n+        upload: { grades_file: @file_wrong_column_name }\n+      expect(response.status).to eq(302)\n+      expect(flash[:error]).to_not be_empty\n+      puts flash[:error]\n+      expect(response).to redirect_to(\n+        grades_grade_entry_form_path(grade_entry_form_with_data, locale: 'en'))\n+    end\n+    \n+    it 'does not accept files with wrong garde total' do\n+      post :csv_upload,\n+        id: grade_entry_form_with_data,","path":"spec/controllers/grade_entry_forms_controller_spec.rb","position":97,"original_position":97,"commit_id":"9d8db18b1da2d53fc30a9aebd04c5b4176bd6599","original_commit_id":"9d8db18b1da2d53fc30a9aebd04c5b4176bd6599","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Align the parameters of a method call if they span more than one line.","created_at":"2015-03-20T02:47:54Z","updated_at":"2015-03-20T02:47:54Z","html_url":"https://github.com/MarkUsProject/Markus/pull/2092#discussion_r26815567","pull_request_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2092","_links":{"self":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments/26815567"},"html":{"href":"https://github.com/MarkUsProject/Markus/pull/2092#discussion_r26815567"},"pull_request":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2092"}}},"pull_request":{"url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2092","id":31584430,"html_url":"https://github.com/MarkUsProject/Markus/pull/2092","diff_url":"https://github.com/MarkUsProject/Markus/pull/2092.diff","patch_url":"https://github.com/MarkUsProject/Markus/pull/2092.patch","issue_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/2092","number":2092,"state":"open","locked":false,"title":"added test for the working csv data files","user":{"login":"MatakuT","id":10067146,"avatar_url":"https://avatars.githubusercontent.com/u/10067146?v=3","gravatar_id":"","url":"https://api.github.com/users/MatakuT","html_url":"https://github.com/MatakuT","followers_url":"https://api.github.com/users/MatakuT/followers","following_url":"https://api.github.com/users/MatakuT/following{/other_user}","gists_url":"https://api.github.com/users/MatakuT/gists{/gist_id}","starred_url":"https://api.github.com/users/MatakuT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatakuT/subscriptions","organizations_url":"https://api.github.com/users/MatakuT/orgs","repos_url":"https://api.github.com/users/MatakuT/repos","events_url":"https://api.github.com/users/MatakuT/events{/privacy}","received_events_url":"https://api.github.com/users/MatakuT/received_events","type":"User","site_admin":false},"body":"Continuing working on: \r\nSimple Grade Entry: Create unit tests and functional tests for CSV upload/download #99","created_at":"2015-03-20T02:47:50Z","updated_at":"2015-03-20T02:47:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2092/commits","review_comments_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2092/comments","review_comment_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/2092/comments","statuses_url":"https://api.github.com/repos/MarkUsProject/Markus/statuses/9d8db18b1da2d53fc30a9aebd04c5b4176bd6599","head":{"label":"MatakuT:iss99_additional_tests","ref":"iss99_additional_tests","sha":"9d8db18b1da2d53fc30a9aebd04c5b4176bd6599","user":{"login":"MatakuT","id":10067146,"avatar_url":"https://avatars.githubusercontent.com/u/10067146?v=3","gravatar_id":"","url":"https://api.github.com/users/MatakuT","html_url":"https://github.com/MatakuT","followers_url":"https://api.github.com/users/MatakuT/followers","following_url":"https://api.github.com/users/MatakuT/following{/other_user}","gists_url":"https://api.github.com/users/MatakuT/gists{/gist_id}","starred_url":"https://api.github.com/users/MatakuT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatakuT/subscriptions","organizations_url":"https://api.github.com/users/MatakuT/orgs","repos_url":"https://api.github.com/users/MatakuT/repos","events_url":"https://api.github.com/users/MatakuT/events{/privacy}","received_events_url":"https://api.github.com/users/MatakuT/received_events","type":"User","site_admin":false},"repo":{"id":29375342,"name":"Markus","full_name":"MatakuT/Markus","owner":{"login":"MatakuT","id":10067146,"avatar_url":"https://avatars.githubusercontent.com/u/10067146?v=3","gravatar_id":"","url":"https://api.github.com/users/MatakuT","html_url":"https://github.com/MatakuT","followers_url":"https://api.github.com/users/MatakuT/followers","following_url":"https://api.github.com/users/MatakuT/following{/other_user}","gists_url":"https://api.github.com/users/MatakuT/gists{/gist_id}","starred_url":"https://api.github.com/users/MatakuT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MatakuT/subscriptions","organizations_url":"https://api.github.com/users/MatakuT/orgs","repos_url":"https://api.github.com/users/MatakuT/repos","events_url":"https://api.github.com/users/MatakuT/events{/privacy}","received_events_url":"https://api.github.com/users/MatakuT/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MatakuT/Markus","description":"Git repository of MarkUs","fork":true,"url":"https://api.github.com/repos/MatakuT/Markus","forks_url":"https://api.github.com/repos/MatakuT/Markus/forks","keys_url":"https://api.github.com/repos/MatakuT/Markus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MatakuT/Markus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MatakuT/Markus/teams","hooks_url":"https://api.github.com/repos/MatakuT/Markus/hooks","issue_events_url":"https://api.github.com/repos/MatakuT/Markus/issues/events{/number}","events_url":"https://api.github.com/repos/MatakuT/Markus/events","assignees_url":"https://api.github.com/repos/MatakuT/Markus/assignees{/user}","branches_url":"https://api.github.com/repos/MatakuT/Markus/branches{/branch}","tags_url":"https://api.github.com/repos/MatakuT/Markus/tags","blobs_url":"https://api.github.com/repos/MatakuT/Markus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MatakuT/Markus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MatakuT/Markus/git/refs{/sha}","trees_url":"https://api.github.com/repos/MatakuT/Markus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MatakuT/Markus/statuses/{sha}","languages_url":"https://api.github.com/repos/MatakuT/Markus/languages","stargazers_url":"https://api.github.com/repos/MatakuT/Markus/stargazers","contributors_url":"https://api.github.com/repos/MatakuT/Markus/contributors","subscribers_url":"https://api.github.com/repos/MatakuT/Markus/subscribers","subscription_url":"https://api.github.com/repos/MatakuT/Markus/subscription","commits_url":"https://api.github.com/repos/MatakuT/Markus/commits{/sha}","git_commits_url":"https://api.github.com/repos/MatakuT/Markus/git/commits{/sha}","comments_url":"https://api.github.com/repos/MatakuT/Markus/comments{/number}","issue_comment_url":"https://api.github.com/repos/MatakuT/Markus/issues/comments{/number}","contents_url":"https://api.github.com/repos/MatakuT/Markus/contents/{+path}","compare_url":"https://api.github.com/repos/MatakuT/Markus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MatakuT/Markus/merges","archive_url":"https://api.github.com/repos/MatakuT/Markus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MatakuT/Markus/downloads","issues_url":"https://api.github.com/repos/MatakuT/Markus/issues{/number}","pulls_url":"https://api.github.com/repos/MatakuT/Markus/pulls{/number}","milestones_url":"https://api.github.com/repos/MatakuT/Markus/milestones{/number}","notifications_url":"https://api.github.com/repos/MatakuT/Markus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MatakuT/Markus/labels{/name}","releases_url":"https://api.github.com/repos/MatakuT/Markus/releases{/id}","created_at":"2015-01-17T01:12:45Z","updated_at":"2015-01-17T01:12:48Z","pushed_at":"2015-03-20T02:46:21Z","git_url":"git://github.com/MatakuT/Markus.git","ssh_url":"git@github.com:MatakuT/Markus.git","clone_url":"https://github.com/MatakuT/Markus.git","svn_url":"https://github.com/MatakuT/Markus","homepage":"http://www.markusproject.org","size":20440,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"MarkUsProject:master","ref":"master","sha":"b8f348e921101e09ac61432184b3497d918b0eb3","user":{"login":"MarkUsProject","id":415874,"avatar_url":"https://avatars.githubusercontent.com/u/415874?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkUsProject","html_url":"https://github.com/MarkUsProject","followers_url":"https://api.github.com/users/MarkUsProject/followers","following_url":"https://api.github.com/users/MarkUsProject/following{/other_user}","gists_url":"https://api.github.com/users/MarkUsProject/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkUsProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkUsProject/subscriptions","organizations_url":"https://api.github.com/users/MarkUsProject/orgs","repos_url":"https://api.github.com/users/MarkUsProject/repos","events_url":"https://api.github.com/users/MarkUsProject/events{/privacy}","received_events_url":"https://api.github.com/users/MarkUsProject/received_events","type":"Organization","site_admin":false},"repo":{"id":940538,"name":"Markus","full_name":"MarkUsProject/Markus","owner":{"login":"MarkUsProject","id":415874,"avatar_url":"https://avatars.githubusercontent.com/u/415874?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkUsProject","html_url":"https://github.com/MarkUsProject","followers_url":"https://api.github.com/users/MarkUsProject/followers","following_url":"https://api.github.com/users/MarkUsProject/following{/other_user}","gists_url":"https://api.github.com/users/MarkUsProject/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkUsProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkUsProject/subscriptions","organizations_url":"https://api.github.com/users/MarkUsProject/orgs","repos_url":"https://api.github.com/users/MarkUsProject/repos","events_url":"https://api.github.com/users/MarkUsProject/events{/privacy}","received_events_url":"https://api.github.com/users/MarkUsProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MarkUsProject/Markus","description":"Git repository of MarkUs","fork":false,"url":"https://api.github.com/repos/MarkUsProject/Markus","forks_url":"https://api.github.com/repos/MarkUsProject/Markus/forks","keys_url":"https://api.github.com/repos/MarkUsProject/Markus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MarkUsProject/Markus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MarkUsProject/Markus/teams","hooks_url":"https://api.github.com/repos/MarkUsProject/Markus/hooks","issue_events_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/events{/number}","events_url":"https://api.github.com/repos/MarkUsProject/Markus/events","assignees_url":"https://api.github.com/repos/MarkUsProject/Markus/assignees{/user}","branches_url":"https://api.github.com/repos/MarkUsProject/Markus/branches{/branch}","tags_url":"https://api.github.com/repos/MarkUsProject/Markus/tags","blobs_url":"https://api.github.com/repos/MarkUsProject/Markus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MarkUsProject/Markus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MarkUsProject/Markus/git/refs{/sha}","trees_url":"https://api.github.com/repos/MarkUsProject/Markus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MarkUsProject/Markus/statuses/{sha}","languages_url":"https://api.github.com/repos/MarkUsProject/Markus/languages","stargazers_url":"https://api.github.com/repos/MarkUsProject/Markus/stargazers","contributors_url":"https://api.github.com/repos/MarkUsProject/Markus/contributors","subscribers_url":"https://api.github.com/repos/MarkUsProject/Markus/subscribers","subscription_url":"https://api.github.com/repos/MarkUsProject/Markus/subscription","commits_url":"https://api.github.com/repos/MarkUsProject/Markus/commits{/sha}","git_commits_url":"https://api.github.com/repos/MarkUsProject/Markus/git/commits{/sha}","comments_url":"https://api.github.com/repos/MarkUsProject/Markus/comments{/number}","issue_comment_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/comments{/number}","contents_url":"https://api.github.com/repos/MarkUsProject/Markus/contents/{+path}","compare_url":"https://api.github.com/repos/MarkUsProject/Markus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MarkUsProject/Markus/merges","archive_url":"https://api.github.com/repos/MarkUsProject/Markus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MarkUsProject/Markus/downloads","issues_url":"https://api.github.com/repos/MarkUsProject/Markus/issues{/number}","pulls_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls{/number}","milestones_url":"https://api.github.com/repos/MarkUsProject/Markus/milestones{/number}","notifications_url":"https://api.github.com/repos/MarkUsProject/Markus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MarkUsProject/Markus/labels{/name}","releases_url":"https://api.github.com/repos/MarkUsProject/Markus/releases{/id}","created_at":"2010-09-26T16:18:08Z","updated_at":"2015-03-19T02:05:25Z","pushed_at":"2015-03-20T02:47:50Z","git_url":"git://github.com/MarkUsProject/Markus.git","ssh_url":"git@github.com:MarkUsProject/Markus.git","clone_url":"https://github.com/MarkUsProject/Markus.git","svn_url":"https://github.com/MarkUsProject/Markus","homepage":"http://www.markusproject.org","size":47814,"stargazers_count":122,"watchers_count":122,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":149,"mirror_url":null,"open_issues_count":109,"forks":149,"open_issues":109,"watchers":122,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2092"},"html":{"href":"https://github.com/MarkUsProject/Markus/pull/2092"},"issue":{"href":"https://api.github.com/repos/MarkUsProject/Markus/issues/2092"},"comments":{"href":"https://api.github.com/repos/MarkUsProject/Markus/issues/2092/comments"},"review_comments":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2092/comments"},"review_comment":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2092/commits"},"statuses":{"href":"https://api.github.com/repos/MarkUsProject/Markus/statuses/9d8db18b1da2d53fc30a9aebd04c5b4176bd6599"}}}}