{"action":"created","comment":{"url":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/comments/35798632","id":35798632,"diff_hunk":"@@ -0,0 +1,141 @@\n+require 'rails_helper'\n+\n+RSpec.describe AccountDetailsController, :type => :controller do\n+\n+  describe \"GET #index\" do\n+    it \"responds successfully with an HTTP 200 status code\" do\n+      get :index\n+      expect(response).to be_success\n+      expect(response).to have_http_status(:success)\n+    end\n+\n+    it \"renders the index template\" do\n+      get :index\n+      expect(response).to render_template :index\n+    end\n+\n+    it \"loads all account details of current user\" do\n+      account_detail1 = create(:account_detail, acct_number: \"0123456789\")\n+      account_detail2 = create(:account_detail, acct_number: \"1234567890\")\n+      get :index\n+      expect(assigns(:account_details)).to match_array([account_detail1, account_detail2])\n+    end\n+  end\n+\n+  describe \"GET #new\" do\n+    it \"returns http success\" do\n+      get :new\n+      expect(response).to have_http_status(:success)\n+    end\n+\n+    it \"assigns a new account detail to current user\" do\n+      get :new\n+      expect(assigns(:account_detail)).to be_a_new(AccountDetail)\n+    end\n+\n+    it \"renders the :new template \" do\n+      get :new\n+      expect(response).to render_template :new\n+    end\n+  end\n+\n+  describe \"POST #create\" do\n+    before :all do\n+      @user = create(:user)\n+    end\n+\n+    before :each do\n+      sign_in @user\n+    end\n+\n+    context \"with valid attributes\" do\n+      it \"saves the new account details in the database\" do\n+        expect {\n+          post :create, account_detail: attributes_for(:account_detail)\n+        }.to change(AccountDetail, :count).by(1)\n+        expect(flash[:notice]).to be_present\n+      end\n+\n+      it \"redirects to account_details#index\" do\n+        post :create, account_detail: attributes_for(:account_detail)\n+        expect(response).to redirect_to account_details_path\n+      end\n+    end\n+\n+    context \"with invalid attributes\" do\n+      it \"does not save the new account details in the database\" do\n+        expect {\n+          post :create, account_detail: attributes_for(:invalid_account_detail)\n+        }.to_not change(AccountDetail, :count)\n+        expect(flash[:notice]).to_not be_present","path":"spec/controllers/account_details_controller_spec.rb","position":70,"original_position":70,"commit_id":"4f26aae790b46664bf716ee0906e3dfb9ba95e29","original_commit_id":"4f26aae790b46664bf716ee0906e3dfb9ba95e29","user":{"login":"andela-bolanrewaju","id":8383666,"avatar_url":"https://avatars.githubusercontent.com/u/8383666?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-bolanrewaju","html_url":"https://github.com/andela-bolanrewaju","followers_url":"https://api.github.com/users/andela-bolanrewaju/followers","following_url":"https://api.github.com/users/andela-bolanrewaju/following{/other_user}","gists_url":"https://api.github.com/users/andela-bolanrewaju/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-bolanrewaju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-bolanrewaju/subscriptions","organizations_url":"https://api.github.com/users/andela-bolanrewaju/orgs","repos_url":"https://api.github.com/users/andela-bolanrewaju/repos","events_url":"https://api.github.com/users/andela-bolanrewaju/events{/privacy}","received_events_url":"https://api.github.com/users/andela-bolanrewaju/received_events","type":"User","site_admin":false},"body":"More reason why you should not test for presence of flash but the content is the scenario where you have to notify the user the error generated when the action fails. You send that back in a flash. Hence this test will fail if there is a notice saying something went wrong.","created_at":"2015-07-29T19:03:07Z","updated_at":"2015-07-29T19:03:07Z","html_url":"https://github.com/bosunolanrewaju/larryproject/pull/6#discussion_r35798632","pull_request_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/comments/35798632"},"html":{"href":"https://github.com/bosunolanrewaju/larryproject/pull/6#discussion_r35798632"},"pull_request":{"href":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/6","id":41155976,"html_url":"https://github.com/bosunolanrewaju/larryproject/pull/6","diff_url":"https://github.com/bosunolanrewaju/larryproject/pull/6.diff","patch_url":"https://github.com/bosunolanrewaju/larryproject/pull/6.patch","issue_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/issues/6","number":6,"state":"open","locked":false,"title":"Feature/setup and test account details controller","user":{"login":"andela-rsadiq","id":10073273,"avatar_url":"https://avatars.githubusercontent.com/u/10073273?v=3","gravatar_id":"","url":"https://api.github.com/users/andela-rsadiq","html_url":"https://github.com/andela-rsadiq","followers_url":"https://api.github.com/users/andela-rsadiq/followers","following_url":"https://api.github.com/users/andela-rsadiq/following{/other_user}","gists_url":"https://api.github.com/users/andela-rsadiq/gists{/gist_id}","starred_url":"https://api.github.com/users/andela-rsadiq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela-rsadiq/subscriptions","organizations_url":"https://api.github.com/users/andela-rsadiq/orgs","repos_url":"https://api.github.com/users/andela-rsadiq/repos","events_url":"https://api.github.com/users/andela-rsadiq/events{/privacy}","received_events_url":"https://api.github.com/users/andela-rsadiq/received_events","type":"User","site_admin":false},"body":"This branch contains work on setting up the AccountDetailController along with its tests.","created_at":"2015-07-29T18:30:46Z","updated_at":"2015-07-29T19:03:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1832c8dca737ea5a9b40abfcb8af7394d87b93d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/6/commits","review_comments_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/6/comments","review_comment_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/issues/6/comments","statuses_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/statuses/4f26aae790b46664bf716ee0906e3dfb9ba95e29","head":{"label":"bosunolanrewaju:feature/setup_and_test_account_details_controller","ref":"feature/setup_and_test_account_details_controller","sha":"4f26aae790b46664bf716ee0906e3dfb9ba95e29","user":{"login":"bosunolanrewaju","id":10594995,"avatar_url":"https://avatars.githubusercontent.com/u/10594995?v=3","gravatar_id":"","url":"https://api.github.com/users/bosunolanrewaju","html_url":"https://github.com/bosunolanrewaju","followers_url":"https://api.github.com/users/bosunolanrewaju/followers","following_url":"https://api.github.com/users/bosunolanrewaju/following{/other_user}","gists_url":"https://api.github.com/users/bosunolanrewaju/gists{/gist_id}","starred_url":"https://api.github.com/users/bosunolanrewaju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosunolanrewaju/subscriptions","organizations_url":"https://api.github.com/users/bosunolanrewaju/orgs","repos_url":"https://api.github.com/users/bosunolanrewaju/repos","events_url":"https://api.github.com/users/bosunolanrewaju/events{/privacy}","received_events_url":"https://api.github.com/users/bosunolanrewaju/received_events","type":"User","site_admin":false},"repo":{"id":37000494,"name":"larryproject","full_name":"bosunolanrewaju/larryproject","owner":{"login":"bosunolanrewaju","id":10594995,"avatar_url":"https://avatars.githubusercontent.com/u/10594995?v=3","gravatar_id":"","url":"https://api.github.com/users/bosunolanrewaju","html_url":"https://github.com/bosunolanrewaju","followers_url":"https://api.github.com/users/bosunolanrewaju/followers","following_url":"https://api.github.com/users/bosunolanrewaju/following{/other_user}","gists_url":"https://api.github.com/users/bosunolanrewaju/gists{/gist_id}","starred_url":"https://api.github.com/users/bosunolanrewaju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosunolanrewaju/subscriptions","organizations_url":"https://api.github.com/users/bosunolanrewaju/orgs","repos_url":"https://api.github.com/users/bosunolanrewaju/repos","events_url":"https://api.github.com/users/bosunolanrewaju/events{/privacy}","received_events_url":"https://api.github.com/users/bosunolanrewaju/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bosunolanrewaju/larryproject","description":"","fork":false,"url":"https://api.github.com/repos/bosunolanrewaju/larryproject","forks_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/forks","keys_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/teams","hooks_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/hooks","issue_events_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/issues/events{/number}","events_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/events","assignees_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/assignees{/user}","branches_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/branches{/branch}","tags_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/tags","blobs_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/git/refs{/sha}","trees_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/statuses/{sha}","languages_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/languages","stargazers_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/stargazers","contributors_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/contributors","subscribers_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/subscribers","subscription_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/subscription","commits_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/commits{/sha}","git_commits_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/git/commits{/sha}","comments_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/comments{/number}","issue_comment_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/issues/comments{/number}","contents_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/contents/{+path}","compare_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/merges","archive_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/downloads","issues_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/issues{/number}","pulls_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls{/number}","milestones_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/milestones{/number}","notifications_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/labels{/name}","releases_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/releases{/id}","created_at":"2015-06-07T01:25:53Z","updated_at":"2015-06-07T01:27:48Z","pushed_at":"2015-07-29T18:30:46Z","git_url":"git://github.com/bosunolanrewaju/larryproject.git","ssh_url":"git@github.com:bosunolanrewaju/larryproject.git","clone_url":"https://github.com/bosunolanrewaju/larryproject.git","svn_url":"https://github.com/bosunolanrewaju/larryproject","homepage":null,"size":272,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"bosunolanrewaju:master","ref":"master","sha":"427a301dbfce594efd3e912ceecf47e1dc2ad753","user":{"login":"bosunolanrewaju","id":10594995,"avatar_url":"https://avatars.githubusercontent.com/u/10594995?v=3","gravatar_id":"","url":"https://api.github.com/users/bosunolanrewaju","html_url":"https://github.com/bosunolanrewaju","followers_url":"https://api.github.com/users/bosunolanrewaju/followers","following_url":"https://api.github.com/users/bosunolanrewaju/following{/other_user}","gists_url":"https://api.github.com/users/bosunolanrewaju/gists{/gist_id}","starred_url":"https://api.github.com/users/bosunolanrewaju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosunolanrewaju/subscriptions","organizations_url":"https://api.github.com/users/bosunolanrewaju/orgs","repos_url":"https://api.github.com/users/bosunolanrewaju/repos","events_url":"https://api.github.com/users/bosunolanrewaju/events{/privacy}","received_events_url":"https://api.github.com/users/bosunolanrewaju/received_events","type":"User","site_admin":false},"repo":{"id":37000494,"name":"larryproject","full_name":"bosunolanrewaju/larryproject","owner":{"login":"bosunolanrewaju","id":10594995,"avatar_url":"https://avatars.githubusercontent.com/u/10594995?v=3","gravatar_id":"","url":"https://api.github.com/users/bosunolanrewaju","html_url":"https://github.com/bosunolanrewaju","followers_url":"https://api.github.com/users/bosunolanrewaju/followers","following_url":"https://api.github.com/users/bosunolanrewaju/following{/other_user}","gists_url":"https://api.github.com/users/bosunolanrewaju/gists{/gist_id}","starred_url":"https://api.github.com/users/bosunolanrewaju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bosunolanrewaju/subscriptions","organizations_url":"https://api.github.com/users/bosunolanrewaju/orgs","repos_url":"https://api.github.com/users/bosunolanrewaju/repos","events_url":"https://api.github.com/users/bosunolanrewaju/events{/privacy}","received_events_url":"https://api.github.com/users/bosunolanrewaju/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bosunolanrewaju/larryproject","description":"","fork":false,"url":"https://api.github.com/repos/bosunolanrewaju/larryproject","forks_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/forks","keys_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/teams","hooks_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/hooks","issue_events_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/issues/events{/number}","events_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/events","assignees_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/assignees{/user}","branches_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/branches{/branch}","tags_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/tags","blobs_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/git/refs{/sha}","trees_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/statuses/{sha}","languages_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/languages","stargazers_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/stargazers","contributors_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/contributors","subscribers_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/subscribers","subscription_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/subscription","commits_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/commits{/sha}","git_commits_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/git/commits{/sha}","comments_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/comments{/number}","issue_comment_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/issues/comments{/number}","contents_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/contents/{+path}","compare_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/merges","archive_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/downloads","issues_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/issues{/number}","pulls_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls{/number}","milestones_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/milestones{/number}","notifications_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/labels{/name}","releases_url":"https://api.github.com/repos/bosunolanrewaju/larryproject/releases{/id}","created_at":"2015-06-07T01:25:53Z","updated_at":"2015-06-07T01:27:48Z","pushed_at":"2015-07-29T18:30:46Z","git_url":"git://github.com/bosunolanrewaju/larryproject.git","ssh_url":"git@github.com:bosunolanrewaju/larryproject.git","clone_url":"https://github.com/bosunolanrewaju/larryproject.git","svn_url":"https://github.com/bosunolanrewaju/larryproject","homepage":null,"size":272,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/6"},"html":{"href":"https://github.com/bosunolanrewaju/larryproject/pull/6"},"issue":{"href":"https://api.github.com/repos/bosunolanrewaju/larryproject/issues/6"},"comments":{"href":"https://api.github.com/repos/bosunolanrewaju/larryproject/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bosunolanrewaju/larryproject/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/bosunolanrewaju/larryproject/statuses/4f26aae790b46664bf716ee0906e3dfb9ba95e29"}}}}