{"action":"created","comment":{"url":"https://api.github.com/repos/neslom/point-box/pulls/comments/26009951","id":26009951,"diff_hunk":"@@ -1,26 +1,58 @@\n require 'rails_helper'\n \n RSpec.describe \"Rewards index page\" do\n-  Reward.create(title: \"Car\", worth: 1000)\n-  Reward.create(title: \"Sandwich\", worth: 50)\n-  let(:user) { User.create(username: \"markus\", password: \"password\") }\n+  let!(:reward_1) { Reward.create(title: \"Car\", worth: 1000) }\n+  let!(:reward_2) { Reward.create(title: \"Sandwich\", worth: 50) }\n+  let!(:user) { User.create(username: \"markus\", password: \"password\", available_points: 900) }\n \n-  xit \"has links to the rewards\" do\n+  before(:each) do\n     allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user)\n-\n     visit rewards_path\n+  end\n+\n+  context \"before the 'redeem reward' link has been clicked\" do\n \n-    expect(page).to have_link(\"Redeem Reward\", href: user_path(user))\n-    # will need to change above expectation\n-    #\n-    # might be best to RedeemedReward.create(user_id: params[:id], reward_id: reward.id)\n-    #   so the same reward isn't created in the Rewards table and same for Users\n-    #\n-    # of course will have to make sure the available points are there on the user, then convert\n-    # those points to redeemed if the join table entry is indeed created\n-    #\n-    # ALSO the Reward.create calls within the main describe block are stil present in the test DB\n-    # after the test. They are being cleaned out before each test run.\n+    it \"has links to the rewards\" do\n+      expect(page).to have_link(\"Redeem Reward\", href: redeemed_rewards_path(reward_id: reward_1.id, user_id: user.id))\n+      expect(page).to have_link(\"Redeem Reward\", href: redeemed_rewards_path(reward_id: reward_2.id, user_id: user.id))\n+    end\n \n   end\n+\n+  context \"when the 'redeem reward' link has been clicked\" do\n+    context \"when the User has enough available points\" do\n+\n+      it \"creates redeemed reward\" do\n+        expect(RedeemedReward.count).to eq(0)\n+\n+        find_link(\"Redeem Reward\", href: redeemed_rewards_path(reward_id: reward_2.id, user_id: user.id)).click","path":"spec/features/reward_index_spec.rb","position":44,"original_position":44,"commit_id":"7ad440cd986bfdbb430298e8a54ee5ee070d00a4","original_commit_id":"7ad440cd986bfdbb430298e8a54ee5ee070d00a4","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":"Line is too long. [111/80]","created_at":"2015-03-08T22:23:29Z","updated_at":"2015-03-08T22:23:29Z","html_url":"https://github.com/neslom/point-box/pull/18#discussion_r26009951","pull_request_url":"https://api.github.com/repos/neslom/point-box/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/neslom/point-box/pulls/comments/26009951"},"html":{"href":"https://github.com/neslom/point-box/pull/18#discussion_r26009951"},"pull_request":{"href":"https://api.github.com/repos/neslom/point-box/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/neslom/point-box/pulls/18","id":30727935,"html_url":"https://github.com/neslom/point-box/pull/18","diff_url":"https://github.com/neslom/point-box/pull/18.diff","patch_url":"https://github.com/neslom/point-box/pull/18.patch","issue_url":"https://api.github.com/repos/neslom/point-box/issues/18","number":18,"state":"open","locked":false,"title":"004 click redeem reward to update associated tables","user":{"login":"neslom","id":8800860,"avatar_url":"https://avatars.githubusercontent.com/u/8800860?v=3","gravatar_id":"","url":"https://api.github.com/users/neslom","html_url":"https://github.com/neslom","followers_url":"https://api.github.com/users/neslom/followers","following_url":"https://api.github.com/users/neslom/following{/other_user}","gists_url":"https://api.github.com/users/neslom/gists{/gist_id}","starred_url":"https://api.github.com/users/neslom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neslom/subscriptions","organizations_url":"https://api.github.com/users/neslom/orgs","repos_url":"https://api.github.com/users/neslom/repos","events_url":"https://api.github.com/users/neslom/events{/privacy}","received_events_url":"https://api.github.com/users/neslom/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-08T22:23:23Z","updated_at":"2015-03-08T22:23:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"28bac70e0ebc01e0b676cfee9d315a0d70b6a5c6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/neslom/point-box/pulls/18/commits","review_comments_url":"https://api.github.com/repos/neslom/point-box/pulls/18/comments","review_comment_url":"https://api.github.com/repos/neslom/point-box/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neslom/point-box/issues/18/comments","statuses_url":"https://api.github.com/repos/neslom/point-box/statuses/7ad440cd986bfdbb430298e8a54ee5ee070d00a4","head":{"label":"neslom:004_click_redeem_reward_to_update_associated_tables","ref":"004_click_redeem_reward_to_update_associated_tables","sha":"7ad440cd986bfdbb430298e8a54ee5ee070d00a4","user":{"login":"neslom","id":8800860,"avatar_url":"https://avatars.githubusercontent.com/u/8800860?v=3","gravatar_id":"","url":"https://api.github.com/users/neslom","html_url":"https://github.com/neslom","followers_url":"https://api.github.com/users/neslom/followers","following_url":"https://api.github.com/users/neslom/following{/other_user}","gists_url":"https://api.github.com/users/neslom/gists{/gist_id}","starred_url":"https://api.github.com/users/neslom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neslom/subscriptions","organizations_url":"https://api.github.com/users/neslom/orgs","repos_url":"https://api.github.com/users/neslom/repos","events_url":"https://api.github.com/users/neslom/events{/privacy}","received_events_url":"https://api.github.com/users/neslom/received_events","type":"User","site_admin":false},"repo":{"id":31738860,"name":"point-box","full_name":"neslom/point-box","owner":{"login":"neslom","id":8800860,"avatar_url":"https://avatars.githubusercontent.com/u/8800860?v=3","gravatar_id":"","url":"https://api.github.com/users/neslom","html_url":"https://github.com/neslom","followers_url":"https://api.github.com/users/neslom/followers","following_url":"https://api.github.com/users/neslom/following{/other_user}","gists_url":"https://api.github.com/users/neslom/gists{/gist_id}","starred_url":"https://api.github.com/users/neslom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neslom/subscriptions","organizations_url":"https://api.github.com/users/neslom/orgs","repos_url":"https://api.github.com/users/neslom/repos","events_url":"https://api.github.com/users/neslom/events{/privacy}","received_events_url":"https://api.github.com/users/neslom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neslom/point-box","description":"","fork":false,"url":"https://api.github.com/repos/neslom/point-box","forks_url":"https://api.github.com/repos/neslom/point-box/forks","keys_url":"https://api.github.com/repos/neslom/point-box/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neslom/point-box/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neslom/point-box/teams","hooks_url":"https://api.github.com/repos/neslom/point-box/hooks","issue_events_url":"https://api.github.com/repos/neslom/point-box/issues/events{/number}","events_url":"https://api.github.com/repos/neslom/point-box/events","assignees_url":"https://api.github.com/repos/neslom/point-box/assignees{/user}","branches_url":"https://api.github.com/repos/neslom/point-box/branches{/branch}","tags_url":"https://api.github.com/repos/neslom/point-box/tags","blobs_url":"https://api.github.com/repos/neslom/point-box/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neslom/point-box/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neslom/point-box/git/refs{/sha}","trees_url":"https://api.github.com/repos/neslom/point-box/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neslom/point-box/statuses/{sha}","languages_url":"https://api.github.com/repos/neslom/point-box/languages","stargazers_url":"https://api.github.com/repos/neslom/point-box/stargazers","contributors_url":"https://api.github.com/repos/neslom/point-box/contributors","subscribers_url":"https://api.github.com/repos/neslom/point-box/subscribers","subscription_url":"https://api.github.com/repos/neslom/point-box/subscription","commits_url":"https://api.github.com/repos/neslom/point-box/commits{/sha}","git_commits_url":"https://api.github.com/repos/neslom/point-box/git/commits{/sha}","comments_url":"https://api.github.com/repos/neslom/point-box/comments{/number}","issue_comment_url":"https://api.github.com/repos/neslom/point-box/issues/comments{/number}","contents_url":"https://api.github.com/repos/neslom/point-box/contents/{+path}","compare_url":"https://api.github.com/repos/neslom/point-box/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neslom/point-box/merges","archive_url":"https://api.github.com/repos/neslom/point-box/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neslom/point-box/downloads","issues_url":"https://api.github.com/repos/neslom/point-box/issues{/number}","pulls_url":"https://api.github.com/repos/neslom/point-box/pulls{/number}","milestones_url":"https://api.github.com/repos/neslom/point-box/milestones{/number}","notifications_url":"https://api.github.com/repos/neslom/point-box/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neslom/point-box/labels{/name}","releases_url":"https://api.github.com/repos/neslom/point-box/releases{/id}","created_at":"2015-03-05T21:59:46Z","updated_at":"2015-03-08T04:44:59Z","pushed_at":"2015-03-08T22:23:09Z","git_url":"git://github.com/neslom/point-box.git","ssh_url":"git@github.com:neslom/point-box.git","clone_url":"https://github.com/neslom/point-box.git","svn_url":"https://github.com/neslom/point-box","homepage":null,"size":0,"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":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"base":{"label":"neslom:master","ref":"master","sha":"26eda8270fa2e282e3153d33b86ae124a5c0d37a","user":{"login":"neslom","id":8800860,"avatar_url":"https://avatars.githubusercontent.com/u/8800860?v=3","gravatar_id":"","url":"https://api.github.com/users/neslom","html_url":"https://github.com/neslom","followers_url":"https://api.github.com/users/neslom/followers","following_url":"https://api.github.com/users/neslom/following{/other_user}","gists_url":"https://api.github.com/users/neslom/gists{/gist_id}","starred_url":"https://api.github.com/users/neslom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neslom/subscriptions","organizations_url":"https://api.github.com/users/neslom/orgs","repos_url":"https://api.github.com/users/neslom/repos","events_url":"https://api.github.com/users/neslom/events{/privacy}","received_events_url":"https://api.github.com/users/neslom/received_events","type":"User","site_admin":false},"repo":{"id":31738860,"name":"point-box","full_name":"neslom/point-box","owner":{"login":"neslom","id":8800860,"avatar_url":"https://avatars.githubusercontent.com/u/8800860?v=3","gravatar_id":"","url":"https://api.github.com/users/neslom","html_url":"https://github.com/neslom","followers_url":"https://api.github.com/users/neslom/followers","following_url":"https://api.github.com/users/neslom/following{/other_user}","gists_url":"https://api.github.com/users/neslom/gists{/gist_id}","starred_url":"https://api.github.com/users/neslom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neslom/subscriptions","organizations_url":"https://api.github.com/users/neslom/orgs","repos_url":"https://api.github.com/users/neslom/repos","events_url":"https://api.github.com/users/neslom/events{/privacy}","received_events_url":"https://api.github.com/users/neslom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neslom/point-box","description":"","fork":false,"url":"https://api.github.com/repos/neslom/point-box","forks_url":"https://api.github.com/repos/neslom/point-box/forks","keys_url":"https://api.github.com/repos/neslom/point-box/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neslom/point-box/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neslom/point-box/teams","hooks_url":"https://api.github.com/repos/neslom/point-box/hooks","issue_events_url":"https://api.github.com/repos/neslom/point-box/issues/events{/number}","events_url":"https://api.github.com/repos/neslom/point-box/events","assignees_url":"https://api.github.com/repos/neslom/point-box/assignees{/user}","branches_url":"https://api.github.com/repos/neslom/point-box/branches{/branch}","tags_url":"https://api.github.com/repos/neslom/point-box/tags","blobs_url":"https://api.github.com/repos/neslom/point-box/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neslom/point-box/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neslom/point-box/git/refs{/sha}","trees_url":"https://api.github.com/repos/neslom/point-box/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neslom/point-box/statuses/{sha}","languages_url":"https://api.github.com/repos/neslom/point-box/languages","stargazers_url":"https://api.github.com/repos/neslom/point-box/stargazers","contributors_url":"https://api.github.com/repos/neslom/point-box/contributors","subscribers_url":"https://api.github.com/repos/neslom/point-box/subscribers","subscription_url":"https://api.github.com/repos/neslom/point-box/subscription","commits_url":"https://api.github.com/repos/neslom/point-box/commits{/sha}","git_commits_url":"https://api.github.com/repos/neslom/point-box/git/commits{/sha}","comments_url":"https://api.github.com/repos/neslom/point-box/comments{/number}","issue_comment_url":"https://api.github.com/repos/neslom/point-box/issues/comments{/number}","contents_url":"https://api.github.com/repos/neslom/point-box/contents/{+path}","compare_url":"https://api.github.com/repos/neslom/point-box/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neslom/point-box/merges","archive_url":"https://api.github.com/repos/neslom/point-box/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neslom/point-box/downloads","issues_url":"https://api.github.com/repos/neslom/point-box/issues{/number}","pulls_url":"https://api.github.com/repos/neslom/point-box/pulls{/number}","milestones_url":"https://api.github.com/repos/neslom/point-box/milestones{/number}","notifications_url":"https://api.github.com/repos/neslom/point-box/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neslom/point-box/labels{/name}","releases_url":"https://api.github.com/repos/neslom/point-box/releases{/id}","created_at":"2015-03-05T21:59:46Z","updated_at":"2015-03-08T04:44:59Z","pushed_at":"2015-03-08T22:23:09Z","git_url":"git://github.com/neslom/point-box.git","ssh_url":"git@github.com:neslom/point-box.git","clone_url":"https://github.com/neslom/point-box.git","svn_url":"https://github.com/neslom/point-box","homepage":null,"size":0,"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":7,"forks":0,"open_issues":7,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neslom/point-box/pulls/18"},"html":{"href":"https://github.com/neslom/point-box/pull/18"},"issue":{"href":"https://api.github.com/repos/neslom/point-box/issues/18"},"comments":{"href":"https://api.github.com/repos/neslom/point-box/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/neslom/point-box/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/neslom/point-box/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neslom/point-box/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/neslom/point-box/statuses/7ad440cd986bfdbb430298e8a54ee5ee070d00a4"}}}}