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

Suggestions from Jon via Seb #5

Open
aslakhellesoy opened this issue Dec 8, 2017 · 0 comments
Open

Suggestions from Jon via Seb #5

aslakhellesoy opened this issue Dec 8, 2017 · 0 comments

Comments

@aslakhellesoy
Copy link
Contributor

aslakhellesoy commented Dec 8, 2017

Hi @sebrose @JonJagger - great suggestions from you below:

Hi Seb,
a few notes from my BDD Kickstart attendance...

  1. there are a few cases of
require './coordinate'

which is perhaps better as
require_relative 'coordinate'

  1. shouty.rb has this...
def shout(person, shout) 
  if (!@shouts.key?(person)) 
    @shouts[person] = [ ] 
  end  
  @shouts[person].push(shout) 
end

I think this would be more idiomatic like this...

def shout(person, shout) 
  @shouts[person] ||= [ ] 
  @shouts[person].push(shout) 
end
  1. in shouts_heard_by(hearer)

there are parentheses around the if expression which is unusual.

  1. the default is to write rspec assertions in the step-definitions.
    For example...
Then('{word} should hear {word}') do |hearer,shouter|
  expect(can_hear?(hearer,shouter)).to be_truthy
end

I find this slightly wordy. Using plain minitest it is

Then('{word} should hear {word}') do |hearer,shouter|
  assert can_hear?(hearer,shouter)
end

To do this I added (and required) the following env.rb file which seemed to do the trick.

require 'minitest/spec'

class MinitestWorld
  include Minitest::Assertions
  attr_accessor :assertions

  def initialize
    self.assertions = 0
  end
end

World do
  MinitestWorld.new
end

Cheers
Jon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant