diff --git a/app/lib/git_hub/client.rb b/app/lib/git_hub/client.rb index 6b10fec4..44b9c9be 100644 --- a/app/lib/git_hub/client.rb +++ b/app/lib/git_hub/client.rb @@ -118,7 +118,7 @@ def check_rate_limit(response) def reset_time(response) seconds = response.headers['X-RateLimit-Reset'].to_i - Time.at(seconds).strftime '%-m/%d/%Y at%l:%M:%S%P %Z' + Time.at(seconds).utc.strftime '%-m/%d/%Y at%l:%M:%S%P %Z' end end end diff --git a/test/controllers/api/v1/airtable/mentorships_controller_test.rb b/test/controllers/api/v1/airtable/mentorships_controller_test.rb index 5f240cef..c25b5ffb 100644 --- a/test/controllers/api/v1/airtable/mentorships_controller_test.rb +++ b/test/controllers/api/v1/airtable/mentorships_controller_test.rb @@ -10,8 +10,8 @@ class Api::V1::Airtable::MentorshipsControllerTest < ActionDispatch::Integration VCR.use_cassette('airtable/mentorship/successful') do get api_v1_airtable_mentorships_path, headers: @headers, as: :json - assert response.status == 200 - assert response.parsed_body.keys.sort == ['mentors', 'services', 'skillsets'] + assert_equal 200, response.status + assert_equal ['mentors', 'services', 'skillsets'], response.parsed_body.keys.sort end end @@ -19,7 +19,7 @@ class Api::V1::Airtable::MentorshipsControllerTest < ActionDispatch::Integration VCR.use_cassette('airtable/mentorship/exceeded_rate_limit') do get api_v1_airtable_mentorships_path, headers: @headers, as: :json - assert response.status == 422 + assert_equal 422, response.status assert response.parsed_body['error'].present? end end @@ -42,7 +42,7 @@ class Api::V1::Airtable::MentorshipsControllerTest < ActionDispatch::Integration as: :json ) - assert response.status == 201 + assert_equal 201, response.status assert response.parsed_body['id'].present? assert response.parsed_body['createdTime'].present? end @@ -66,7 +66,7 @@ class Api::V1::Airtable::MentorshipsControllerTest < ActionDispatch::Integration as: :json ) - assert response.status == 201 + assert_equal 201, response.status assert response.parsed_body['id'].present? assert response.parsed_body['createdTime'].present? end diff --git a/test/controllers/api/v1/code_schools_controller_test.rb b/test/controllers/api/v1/code_schools_controller_test.rb index 59df58b6..0ddb16ca 100644 --- a/test/controllers/api/v1/code_schools_controller_test.rb +++ b/test/controllers/api/v1/code_schools_controller_test.rb @@ -64,11 +64,11 @@ class Api::V1::CodeSchoolsControllerTest < ActionDispatch::IntegrationTest dojo = code_schools[0] wynode = code_schools[1] - assert dojo['name'] == coding_dojo.name - assert wynode['name'] == wynode_academy.name + assert_equal dojo['name'], coding_dojo.name + assert_equal wynode['name'], wynode_academy.name - assert cities_for(dojo) == [dojo_la.city, dojo_san_fran.city] - assert cities_for(wynode) == [wynode_denver.city, wynode_dallas.city] + assert_equal cities_for(dojo), [dojo_la.city, dojo_san_fran.city] + assert_equal cities_for(wynode), [wynode_denver.city, wynode_dallas.city] end test ':create endpoint creates a CodeSchool successfully' do diff --git a/test/controllers/api/v1/slack_users_controller_test.rb b/test/controllers/api/v1/slack_users_controller_test.rb index a2352854..3265451c 100644 --- a/test/controllers/api/v1/slack_users_controller_test.rb +++ b/test/controllers/api/v1/slack_users_controller_test.rb @@ -10,8 +10,8 @@ class Api::V1::SlackUsersControllerTest < ActionDispatch::IntegrationTest body = JSON.parse(response.body) - assert response.status == 200 - assert body == { 'message' => 'You have access!' } + assert_equal response.status, 200 + assert_equal body, { 'message' => 'You have access!' } end test ':access returns a 401 with an incorrect token' do @@ -23,8 +23,8 @@ class Api::V1::SlackUsersControllerTest < ActionDispatch::IntegrationTest body = JSON.parse(response.body) - assert response.status == 401 - assert body == { 'errors' => ['Auth token is invalid'] } + assert_equal response.status, 401 + assert_equal body, { 'errors' => ['Auth token is invalid'] } end test ':access returns a 401 with an expired token' do @@ -36,8 +36,8 @@ class Api::V1::SlackUsersControllerTest < ActionDispatch::IntegrationTest body = JSON.parse(response.body) - assert response.status == 401 - assert body == { 'errors' => ['Auth token has expired'] } + assert_equal response.status, 401 + assert_equal body, { 'errors' => ['Auth token has expired'] } end test ':access returns a 401 with a malformed token' do @@ -49,8 +49,8 @@ class Api::V1::SlackUsersControllerTest < ActionDispatch::IntegrationTest body = JSON.parse(response.body) - assert response.status == 401 - assert body == { 'errors' => ['Invalid auth token'] } + assert_equal response.status, 401 + assert_equal body, { 'errors' => ['Invalid auth token'] } end end diff --git a/test/lib/git_hub/authentication_test.rb b/test/lib/git_hub/authentication_test.rb index 94f16a43..e6dc4d75 100644 --- a/test/lib/git_hub/authentication_test.rb +++ b/test/lib/git_hub/authentication_test.rb @@ -21,30 +21,29 @@ class GitHub::AuthenticationTest < ActiveSupport::TestCase end test 'initialize constructs the expected variable' do - assert @instance.options == @options - assert @instance.auth_level == GitHub::Authentication::O_AUTH_2_KEY_SECRET + assert_equal @options, @instance.options + assert_equal GitHub::Authentication::O_AUTH_2_KEY_SECRET, @instance.auth_level end test '#set_options returns the passed in options when Rails.env.prod? is false' do - assert @instance.set_options == @options + assert @options, @instance.set_options end test '#set_options merges the authenticated OAUTH_KEY options hash when Rails.env.prod? is true' do Rails.env.stubs(:prod?).returns(true) - assert @instance.set_options == { - :query => - { - :client_id => 'some random id', - :client_secret => 'some random key', - :per_page => 100 - }, - :headers => - { - 'Accepts' => 'application/vnd.github.v3+json', - 'User-Agent' => 'operationcode' - } - } + assert_equal @instance.set_options, + :query => + { + :client_id => 'some random id', + :client_secret => 'some random key', + :per_page => 100 + }, + :headers => + { + 'Accepts' => 'application/vnd.github.v3+json', + 'User-Agent' => 'operationcode' + } end test '#set_options merges the authenticated OAUTH_TOKEN options hash when Rails.env.prod? is true' do @@ -52,17 +51,16 @@ class GitHub::AuthenticationTest < ActiveSupport::TestCase Rails.env.stubs(:prod?).returns(true) instance = GitHub::Authentication.new(@options) - assert instance.set_options == { - :query => - { - :per_page => 100 - }, - :headers => - { - 'Accepts' => 'application/vnd.github.v3+json', - 'User-Agent' => 'operationcode', - 'Authorization' => "Bearer #{GitHub::Settings.o_auth_2_token}" - } - } + assert_equal instance.set_options, + :query => + { + :per_page => 100 + }, + :headers => + { + 'Accepts' => 'application/vnd.github.v3+json', + 'User-Agent' => 'operationcode', + 'Authorization' => "Bearer #{GitHub::Settings.o_auth_2_token}" + } end end diff --git a/test/lib/git_hub/committer_test.rb b/test/lib/git_hub/committer_test.rb index f5f97b69..1201e285 100644 --- a/test/lib/git_hub/committer_test.rb +++ b/test/lib/git_hub/committer_test.rb @@ -32,14 +32,14 @@ class GitHub::CommitterTest < ActiveSupport::TestCase user = GitHub::Committer.find_or_create_user! @user_attrs - assert GitHubUser.first == user + assert_equal user, GitHubUser.first end test '.find_or_create_user! returns the existing matched user' do user = create :git_hub_user, git_hub_login: @user_attrs[:login] results = GitHub::Committer.find_or_create_user! @user_attrs.merge(id: user.git_hub_id) - assert results == user + assert_equal user, results end test '.find_or_create_statistic! creates and returns non-existing GitHubStatistic' do @@ -51,7 +51,7 @@ class GitHub::CommitterTest < ActiveSupport::TestCase create(:git_hub_user).id ) - assert GitHubStatistic.first == stat + assert_equal stat, GitHubStatistic.first end test '.find_or_create_statistic! returns the existing matched user' do @@ -68,6 +68,6 @@ class GitHub::CommitterTest < ActiveSupport::TestCase user.git_hub_id ) - assert results == stat + assert_equal stat, results end end diff --git a/test/lib/send_grid_client/guest_test.rb b/test/lib/send_grid_client/guest_test.rb index fba56853..60f33a72 100644 --- a/test/lib/send_grid_client/guest_test.rb +++ b/test/lib/send_grid_client/guest_test.rb @@ -10,24 +10,23 @@ class SendGridClient::GuestTest < ActiveSupport::TestCase test "#user creates an :id method that defaults to 'guest-id'" do guest = SendGridClient::Guest.user(valid_email) - assert guest.id == 'guest-id' + assert 'guest-id', guest.id end test '#user creates an :email method that is set to the passed email address' do guest = SendGridClient::Guest.user(valid_email) - assert guest.email == valid_email + assert_equal valid_email, guest.email end test "#attributes returns JSON for the Struct's id, first_name, last_name, and email" do guest = SendGridClient::Guest.user(valid_email) - assert guest.attributes == { - 'id' => 'guest-id', - 'email' => valid_email, - 'first_name' => '', - 'last_name' => '' - } + assert_equal guest.attributes, + 'id' => 'guest-id', + 'email' => valid_email, + 'first_name' => '', + 'last_name' => '' end end diff --git a/test/models/code_schools_test.rb b/test/models/code_schools_test.rb index 749b48ee..e7a9e7f0 100644 --- a/test/models/code_schools_test.rb +++ b/test/models/code_schools_test.rb @@ -6,7 +6,7 @@ def setup end test 'is_partner should be present and default to false' do - assert @code_school.is_partner == false + assert_not @code_school.is_partner end test 'rep_name should be present' do diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 3075317e..652d07f3 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -45,7 +45,7 @@ def teardown some_role = create :role user.update! role_id: some_role.id - assert user.role == some_role + assert_equal some_role, user.role end test 'doesnt geocode until we validate' do @@ -75,11 +75,11 @@ def teardown test 'validates the presence of a zip' do user = build :user, zip: nil refute user.valid? - assert user.errors.full_messages == ["Zip can't be blank"] + assert_equal ["Zip can't be blank"], user.errors.full_messages user = build :user, zip: '' refute user.valid? - assert user.errors.full_messages == ["Zip can't be blank"] + assert ["Zip can't be blank"], user.errors.full_messages end test 'longitude and longitude are nil for unknown zipcodes' do diff --git a/test/requests/airtable/mentorship_test.rb b/test/requests/airtable/mentorship_test.rb index fe83958d..67b452e2 100644 --- a/test/requests/airtable/mentorship_test.rb +++ b/test/requests/airtable/mentorship_test.rb @@ -8,7 +8,7 @@ def setup end def test_mentor_request_data_returns_correct_keys - assert @successful_response.keys.sort == %i[mentors services skillsets] + assert_equal %i[mentors services skillsets], @successful_response.keys.sort end def test_mentor_request_data_returns_correct_mentor_data @@ -54,12 +54,12 @@ def test_create_mentor_request_creates_the_passed_mentor_request response = Airtable::Mentorship.new.create_mentor_request(request_body) assert response['id'].present? - assert response.dig('fields', 'Slack User') == request_body[:slack_user] - assert response.dig('fields', 'Email') == request_body[:email] - assert response.dig('fields', 'Service') == [request_body[:services]] - assert response.dig('fields', 'Skillsets') == [request_body[:skillsets]] - assert response.dig('fields', 'Additional Details') == request_body[:additional_details] - assert response.dig('fields', 'Mentor Requested') == [request_body[:mentor_requested]] + assert_equal request_body[:slack_user], response.dig('fields', 'Slack User') + assert_equal request_body[:email], response.dig('fields', 'Email') + assert_equal [request_body[:services]], response.dig('fields', 'Service') + assert_equal [request_body[:skillsets]], response.dig('fields', 'Skillsets') + assert_equal request_body[:additional_details], response.dig('fields', 'Additional Details') + assert_equal [request_body[:mentor_requested]], response.dig('fields', 'Mentor Requested') end end @@ -67,12 +67,12 @@ def test_format_for_posting_converts_comma_separated_string_into_array_of_string instance = Airtable::Mentorship.new converted = instance.send(:format_for_posting, 'this , and long ') - assert converted == ['this', 'and long'] + assert_equal ['this', 'and long'], converted converted = instance.send(:format_for_posting, 'this,that') - assert converted == ['this', 'that'] + assert_equal ['this', 'that'], converted converted = instance.send(:format_for_posting, 'this') - assert converted == ['this'] + assert_equal ['this'], converted end end diff --git a/test/requests/git_hub/client_test.rb b/test/requests/git_hub/client_test.rb index 35ed9917..efcedaa8 100644 --- a/test/requests/git_hub/client_test.rb +++ b/test/requests/git_hub/client_test.rb @@ -25,12 +25,12 @@ def test_successful_search_for_prs_for_multi_page ## link presence means there are multiple pages of results assert response.headers['link'].present? assert response['items'].present? - assert response.code.to_i == 200 - assert pr['html_url'] == 'https://github.com/OperationCode/operationcode/pull/753' - assert pr['id'] == 240032714 - assert pr['number'] == @pr_number - assert pr['title'] == 'Revert "waffle.io Badge"' - assert pr['state'] == 'closed' + assert_equal 200, response.code.to_i + assert_equal 'https://github.com/OperationCode/operationcode/pull/753', pr['html_url'] + assert_equal 240032714, pr['id'] + assert_equal @pr_number, pr['number'] + assert_equal 'Revert "waffle.io Badge"', pr['title'] + assert_equal 'closed', pr['state'] end def test_successful_search_for_prs_for_single_page @@ -49,14 +49,14 @@ def test_successful_search_for_prs_for_single_page pr = response['items'].first ## link absence means there is only one page of results - assert response.headers['link'].present? == false + refute response.headers['link'].present? assert response['items'].present? - assert response.code.to_i == 200 - assert pr['html_url'] == 'https://github.com/OperationCode/operationcode_slashbot/pull/7' - assert pr['id'] == 221728378 - assert pr['number'] == 7 - assert pr['title'] == 'Add /android case' - assert pr['state'] == 'closed' + assert_equal 200, response.code.to_i + assert_equal 'https://github.com/OperationCode/operationcode_slashbot/pull/7', pr['html_url'] + assert_equal 221728378, pr['id'] + assert_equal 7, pr['number'] + assert_equal 'Add /android case', pr['title'] + assert_equal 'closed', pr['state'] end def test_successful_search_for_issues @@ -75,15 +75,15 @@ def test_successful_search_for_issues issue = response['items'].first ## link absence means there is only one page of results - assert response.headers['link'].present? == false + refute response.headers['link'].present? assert response['items'].present? - assert response['items'].size == 59 - assert response.code.to_i == 200 - assert issue['html_url'] == 'https://github.com/OperationCode/operationcode_backend/issues/140' - assert issue['id'] == 250032036 - assert issue['number'] == 140 - assert issue['title'] == "Correct the spelling for 'distributions' in the contribution guide" - assert issue['state'] == 'closed' + assert_equal 59, response['items'].size + assert_equal 200, response.code.to_i + assert_equal 'https://github.com/OperationCode/operationcode_backend/issues/140', issue['html_url'] + assert_equal 250032036, issue['id'] + assert_equal 140, issue['number'] + assert_equal "Correct the spelling for 'distributions' in the contribution guide", issue['title'] + assert_equal 'closed', issue['state'] end def test_successful_single_pull_request @@ -93,19 +93,19 @@ def test_successful_single_pull_request pr = response.parsed_response - assert pr['id'] == 128533020 - assert pr['number'] == 753 - assert pr['additions'] == 0 - assert pr['deletions'] == 3 - assert pr['html_url'] == 'https://github.com/OperationCode/operationcode/pull/753' - assert pr['title'] == 'Revert "waffle.io Badge"' - assert pr['merged_at'] == '2017-07-02T20:32:11Z' - - assert pr['user']['login'] == 'hollomancer' - assert pr['user']['avatar_url'] == 'https://avatars3.githubusercontent.com/u/9288648?v=4' - assert pr['user']['url'] == 'https://api.github.com/users/hollomancer' - assert pr['user']['html_url'] == 'https://github.com/hollomancer' - assert pr['user']['id'] == 9288648 + assert_equal 128533020, pr['id'] + assert_equal 753, pr['number'] + assert_equal 0, pr['additions'] + assert_equal 3, pr['deletions'] + assert_equal 'https://github.com/OperationCode/operationcode/pull/753', pr['html_url'] + assert_equal 'Revert "waffle.io Badge"', pr['title'] + assert_equal '2017-07-02T20:32:11Z', pr['merged_at'] + + assert_equal 'hollomancer', pr['user']['login'] + assert_equal 'https://avatars3.githubusercontent.com/u/9288648?v=4', pr['user']['avatar_url'] + assert_equal 'https://api.github.com/users/hollomancer', pr['user']['url'] + assert_equal 'https://github.com/hollomancer', pr['user']['html_url'] + assert_equal 9288648, pr['user']['id'] end def test_successful_commits_for @@ -116,18 +116,18 @@ def test_successful_commits_for commit = response.parsed_response.first assert response.headers['link'].nil? - assert response.parsed_response.class == Array - assert response.parsed_response.size == 1 - assert commit['sha'] == '3d4ff7164a33fa1c6006d34942872d1c22594b99' - assert commit['html_url'] == 'https://github.com/OperationCode/operationcode/commit/3d4ff7164a33fa1c6006d34942872d1c22594b99' - assert commit['commit']['message'] == "Revert \"waffle.io Badge (#752)\"\n\nThis reverts commit ac38898ddeae5ddd17cdb6addba1b52fc6da923a." - assert commit['commit']['committer']['date'] == '2017-07-02T20:31:56Z' - - assert commit['author']['login'] == 'hollomancer' - assert commit['author']['avatar_url'] == 'https://avatars3.githubusercontent.com/u/9288648?v=4' - assert commit['author']['url'] == 'https://api.github.com/users/hollomancer' - assert commit['author']['html_url'] == 'https://github.com/hollomancer' - assert commit['author']['id'] == 9288648 + assert_equal Array, response.parsed_response.class + assert_equal 1, response.parsed_response.size + assert_equal '3d4ff7164a33fa1c6006d34942872d1c22594b99', commit['sha'] + assert_equal 'https://github.com/OperationCode/operationcode/commit/3d4ff7164a33fa1c6006d34942872d1c22594b99', commit['html_url'] + assert_equal "Revert \"waffle.io Badge (#752)\"\n\nThis reverts commit ac38898ddeae5ddd17cdb6addba1b52fc6da923a.", commit['commit']['message'] + assert_equal '2017-07-02T20:31:56Z', commit['commit']['committer']['date'] + + assert_equal 'hollomancer', commit['author']['login'] + assert_equal 'https://avatars3.githubusercontent.com/u/9288648?v=4', commit['author']['avatar_url'] + assert_equal 'https://api.github.com/users/hollomancer', commit['author']['url'] + assert_equal 'https://github.com/hollomancer', commit['author']['html_url'] + assert_equal 9288648, commit['author']['id'] end def test_rate_limit_presence @@ -135,9 +135,9 @@ def test_rate_limit_presence @client.commits_for(@oc, @pr_number, 1) end - assert response.headers['X-RateLimit-Remaining'] == '57' - assert response.headers['X-RateLimit-Limit'] == '60' - assert response.headers['X-RateLimit-Reset'] == '1503866476' - assert @client.send(:reset_time, response) == '8/27/2017 at 8:41:16pm UTC' + assert_equal '57', response.headers['X-RateLimit-Remaining'] + assert_equal '60', response.headers['X-RateLimit-Limit'] + assert_equal '1503866476', response.headers['X-RateLimit-Reset'] + assert_equal '8/27/2017 at 8:41:16pm UTC', @client.send(:reset_time, response) end end diff --git a/test/requests/git_hub/issues_test.rb b/test/requests/git_hub/issues_test.rb index 1c91f804..e242e529 100644 --- a/test/requests/git_hub/issues_test.rb +++ b/test/requests/git_hub/issues_test.rb @@ -37,11 +37,11 @@ def test_get_issues def test_fetch_and_save @issue_instance.fetch_and_save!(print_results: false) - assert GitHubStatistic.for_repository(@backend).count == 28 - assert GitHubStatistic.for_repository(@backend).issues.count == 28 - assert GitHubStatistic.for_repository(@backend).pluck(:title).uniq.count == 28 - assert GitHubStatistic.for_repository(@backend).pluck(:number).uniq.count == 28 - assert GitHubUser.count == 4 + assert_equal 28, GitHubStatistic.for_repository(@backend).count + assert_equal 28, GitHubStatistic.for_repository(@backend).issues.count + assert_equal 28, GitHubStatistic.for_repository(@backend).pluck(:title).uniq.count + assert_equal 28, GitHubStatistic.for_repository(@backend).pluck(:number).uniq.count + assert_equal 4, GitHubUser.count end def stub_client_calls @@ -50,13 +50,13 @@ def stub_client_calls end def issues_assertions - assert @issue_instance.compiled_issues.size == 28 - assert @issue_instance.compiled_issues.map { |stat| stat[:source_type] }.uniq == ['Issue'] - assert @issue_instance.compiled_issues.map { |stat| stat[:state] }.uniq == ['closed'] - assert @issue_instance.compiled_issues.map { |stat| stat[:repository] }.uniq == ['operationcode_backend'] - assert @issue_instance.compiled_issues.first[:url] == 'https://github.com/OperationCode/operationcode_backend/issues/133' - assert @issue_instance.compiled_issues.first[:title] == 'Support for multi step profiles' - assert @issue_instance.compiled_issues.first[:number] == 133 - assert @issue_instance.compiled_issues.first[:source_id] == 248273181 + assert_equal 28, @issue_instance.compiled_issues.size + assert_equal ['Issue'], @issue_instance.compiled_issues.map { |stat| stat[:source_type] }.uniq + assert_equal ['closed'], @issue_instance.compiled_issues.map { |stat| stat[:state] }.uniq + assert_equal ['operationcode_backend'], @issue_instance.compiled_issues.map { |stat| stat[:repository] }.uniq + assert_equal 'https://github.com/OperationCode/operationcode_backend/issues/133', @issue_instance.compiled_issues.first[:url] + assert_equal 'Support for multi step profiles', @issue_instance.compiled_issues.first[:title] + assert_equal 133, @issue_instance.compiled_issues.first[:number] + assert_equal 248273181, @issue_instance.compiled_issues.first[:source_id] end end diff --git a/test/requests/git_hub/page_compiler_test.rb b/test/requests/git_hub/page_compiler_test.rb index 33d53f08..1b9063ce 100644 --- a/test/requests/git_hub/page_compiler_test.rb +++ b/test/requests/git_hub/page_compiler_test.rb @@ -24,13 +24,13 @@ def test_for_compile_prs pr = compiled_prs.last - assert compiled_prs.size == 249 - assert compiled_prs.class == Array - assert pr.class.to_s == 'Hash' - assert pr['html_url'] == 'https://github.com/OperationCode/operationcode/pull/2' - assert pr['id'] == 66372782 - assert pr['number'] == 2 - assert pr['title'] == 'Ignore OSX system files' - assert pr['state'] == 'closed' + assert_equal 249, compiled_prs.size + assert_equal Array, compiled_prs.class + assert_equal Hash, pr.class + assert_equal 'https://github.com/OperationCode/operationcode/pull/2', pr['html_url'] + assert_equal 66372782, pr['id'] + assert_equal 2, pr['number'] + assert_equal 'Ignore OSX system files', pr['title'] + assert_equal 'closed', pr['state'] end end diff --git a/test/requests/git_hub/pull_requests_test.rb b/test/requests/git_hub/pull_requests_test.rb index 226e6f56..0389349b 100644 --- a/test/requests/git_hub/pull_requests_test.rb +++ b/test/requests/git_hub/pull_requests_test.rb @@ -53,10 +53,10 @@ def test_get_pull_requests def test_fetch_and_save @pr_instance.fetch_and_save!(print_results: false) - assert GitHubStatistic.for_repository(@slash).count == 4 - assert GitHubStatistic.for_repository(@slash).pull_requests.count == 2 - assert GitHubStatistic.for_repository(@slash).commits.count == 2 - assert GitHubUser.count == 2 + assert_equal 4, GitHubStatistic.for_repository(@slash).count + assert_equal 2, GitHubStatistic.for_repository(@slash).pull_requests.count + assert_equal 2, GitHubStatistic.for_repository(@slash).commits.count + assert_equal 2, GitHubUser.count assert GitHubStatistic.for_repository(@slash).pull_requests.find_by(number: @pr_6_response.parsed_response['number'].to_s) assert GitHubStatistic.for_repository(@slash).pull_requests.find_by(number: @pr_7_response.parsed_response['number'].to_s) end @@ -71,18 +71,18 @@ def stub_client_calls end def pull_requests_assertions - assert @pr_instance.compiled_pull_requests.size == 4 - assert @pr_instance.compiled_pull_requests.first[:source_type] == 'PullRequest' - assert @pr_instance.compiled_pull_requests.first[:number] == 7 - assert @pr_instance.compiled_pull_requests.first[:repository] == 'operationcode_slashbot' + assert_equal 4, @pr_instance.compiled_pull_requests.size + assert_equal 'PullRequest', @pr_instance.compiled_pull_requests.first[:source_type] + assert_equal 7, @pr_instance.compiled_pull_requests.first[:number] + assert_equal 'operationcode_slashbot', @pr_instance.compiled_pull_requests.first[:repository] - assert @pr_instance.compiled_pull_requests.second[:source_type] == 'Commit' - assert @pr_instance.compiled_pull_requests.second[:title] == 'Add /android case' + assert_equal 'Commit', @pr_instance.compiled_pull_requests.second[:source_type] + assert_equal 'Add /android case', @pr_instance.compiled_pull_requests.second[:title] - assert @pr_instance.compiled_pull_requests.third[:source_type] == 'Commit' - assert @pr_instance.compiled_pull_requests.third[:title] == 'Change environment variable for node' + assert_equal 'Commit', @pr_instance.compiled_pull_requests.third[:source_type] + assert_equal 'Change environment variable for node', @pr_instance.compiled_pull_requests.third[:title] - assert @pr_instance.compiled_pull_requests.last[:source_type] == 'PullRequest' - assert @pr_instance.compiled_pull_requests.last[:number] == 6 + assert_equal 'PullRequest', @pr_instance.compiled_pull_requests.last[:source_type] + assert_equal 6, @pr_instance.compiled_pull_requests.last[:number] end end