Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes tests on master #6

Merged
merged 1 commit into from
Feb 2, 2018
Merged

Fixes tests on master #6

merged 1 commit into from
Feb 2, 2018

Conversation

raychatter
Copy link
Contributor

@raychatter raychatter commented Feb 1, 2018

What

  • Fixes rubocop failures using default rules with the exception of one
    case
  • Removes CodeClimate from the code because its implementation was
    deprecated on TravisCI. I opened an issue to look into this: Code Climate Integration #7
  • Added the latest stable ruby version (that RVM has to offer) to run on
    TravisCI
  • Did the minimum necessary to mock out the repo linter functionality so
    that the existing tests will pass. I will make a follow-up eventually
    to write tests for the repo linter.
  • Fixed some small things in the existing tests to get them to pass
  • Added test coverage to the Runner spec.

@raychatter raychatter force-pushed the fixin-failures branch 2 times, most recently from b1108e0 to b9cb493 Compare February 1, 2018 05:26
@@ -26,6 +26,9 @@ Metrics/CyclomaticComplexity:
Metrics/ParameterLists:
Max: 10

Style/AccessorMethodName:
Enabled: false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -4,6 +4,7 @@ rvm:
- 2.1
- 2.2
- 2.3.0
- 2.4.3
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest stable ruby RVM offers right now


group :test do
gem 'codeclimate-test-reporter'
end
Copy link
Contributor Author

@raychatter raychatter Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: #7

@@ -63,7 +63,7 @@ def config_file_contents
end

def config_file_path
'./.scrum-lint.yml'
ENV.fetch('config_file_path', './.scrum-lint.yml')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allows the user to specify where the .scrum-lint.yml file is located. This helps the test specs not use the real config file.

@@ -63,7 +63,7 @@ def lookup_project_card(context_link)
ScrumLint::Trello::CardMapper.(
trello_card,
list: trello_card.list,
board_name: trello_card.board.name,
board_name: trello_card.board.name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RuboCop yelled: Style/TrailingCommaInArguments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so is the idea for this PR just to get everything passing, and then if we want to change the rubocop rules we can go back and do that in followups?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaifius Yup, exactly. I wanted to touch the minimum amount of things to get a passing build and then be more intentional in follow-ups. If you have some suggestions for things to improve, let me know!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, yeah, i think we should enable this rule and rename get_value to enable the other rule in followups. Or maybe even paste in synchroform's rubocop.yml and see what fails

@@ -3,7 +3,7 @@ module InteractiveLinter
# checks that cards have #HashTag and interactively assigns
class MissingHashTag < InteractiveLinter::Base

MESSAGE = 'missing hashtag'
MESSAGE = 'missing hashtag'.freeze
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RuboCop yelled: Style/MutableConstant

@@ -10,7 +10,7 @@ def call(trello_list, board_name:)
list.cards = mapped_cards(
list: list,
trello_list: trello_list,
board_name: board_name,
board_name: board_name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RuboCop yelled: Style/TrailingCommaInArguments

@@ -1,3 +1,4 @@
trello_developer_public_key: nope
trello_member_token: nada
github_access_token: foo
github_repo_names: ['foo/bar']
Copy link
Contributor Author

@raychatter raychatter Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the github repo mapper functionality that's now in configuration.rb

it 'aborts when .scrum-lint.yml is missing' do
file_path = './.scrum-lint.yml'
it 'aborts when config file is missing' do
file_path = ENV.fetch('config_file_path')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test modified to allow for configurable path to .scrum-lint.yml

@@ -1,6 +1,7 @@
RSpec.describe ScrumLint::Card do
let(:card_params) do
{
board_name: nil,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required param for instantiating a ScrumLint::Card

@@ -3,7 +3,12 @@ module ScrumLint
let(:runner) { described_class.new }

before(:each) do
allow(Launchy).to receive(:open)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stubbed objects may not be completely valid, so don't open Launchy at all

expect(Linter::MissingContext).not_to have_received(:call)
expect(Linter::MissingExpendedPoints).to have_received(:call)
.with(instance_of(Card))
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added code coverage! 🎉

allow(::Trello::Board).to receive(:all).and_return([fake_trello_board])
allow(::Trello::Card).to receive(:find).and_return(fake_trello_card)

allow(Octokit::Source).to receive(:call).and_return([])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll deal with tests for the repo linter stuff later

runner.([])
expect(Linter::MissingTaskList).to have_received(:call)
.with(instance_of(Board))
expect(Linter::ExtraList).to have_received(:call).with(instance_of(Board))
expect(Linter::ExtraList).to have_received(:call).with(instance_of(Board))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added code coverage! 🎉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does having this line here twice mean we expect this method to be called twice? if so i think you can do have_received(:call).twice.with(..)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha nope. It means I wasn't very careful with my copy/pasta-ing.

else
SimpleCov.start
end
SimpleCov.start
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: #7

short_url: 'https://foo.bar.baz.biz',
url: 'https://something.much.longer',
**options
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attributes needed to properly instantiate a Card object

end

def fake_trello_list(name: 'Planned', cards: [])
def fake_trello_list(name: 'Planned', cards: [fake_trello_card])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have at least one card in the list by default

@raychatter raychatter requested a review from kaifius February 1, 2018 07:10
@raychatter raychatter added the bug label Feb 1, 2018
@raychatter raychatter changed the title WIP: Making tests pass Fixes tests on master Feb 1, 2018
Copy link
Contributor

@kaifius kaifius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eeeeee exciting! just a couple lil comentarios

@@ -63,7 +63,7 @@ def lookup_project_card(context_link)
ScrumLint::Trello::CardMapper.(
trello_card,
list: trello_card.list,
board_name: trello_card.board.name,
board_name: trello_card.board.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so is the idea for this PR just to get everything passing, and then if we want to change the rubocop rules we can go back and do that in followups?

runner.([])
expect(Linter::MissingTaskList).to have_received(:call)
.with(instance_of(Board))
expect(Linter::ExtraList).to have_received(:call).with(instance_of(Board))
expect(Linter::ExtraList).to have_received(:call).with(instance_of(Board))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does having this line here twice mean we expect this method to be called twice? if so i think you can do have_received(:call).twice.with(..)

expect(Linter::MissingExpendedPoints).not_to have_received(:call)
end

it 'runs linters where card tags are superset of linter tags' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you update the it statement here to differentiate it from the one above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good catch. Being half asleep is probably not the best time for programming. I'll also add a little more coverage.

**What**

- Fixes rubocop failures using default rules with the exception of one
  case
- Removes CodeClimate from the code because its implementation was
  deprecated on TravisCI. I opened an issue to look into this:
  #7
- Added the latest stable ruby version (that RVM has to offer) to run on
  TravisCI
- Did the minimum necessary to mock out the repo linter functionality so
  that the existing tests will pass. I will make a follow-up eventually
  to write tests for the repo linter.
- Fixed some small things in the existing tests to get them to pass
- Added test coverage to the `Runner` spec.
@raychatter
Copy link
Contributor Author

Updated per comments.

@raychatter raychatter assigned kaifius and unassigned raychatter Feb 2, 2018
@kaifius kaifius merged commit 1fc1689 into master Feb 2, 2018
@kaifius kaifius deleted the fixin-failures branch February 2, 2018 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants