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

Passes the test with a wrong behaviour #61

Open
abdellani opened this issue Feb 3, 2019 · 0 comments
Open

Passes the test with a wrong behaviour #61

abdellani opened this issue Feb 3, 2019 · 0 comments

Comments

@abdellani
Copy link

Hello
I don't understand why my program passes this test ?
Instead of "a---a-", my method returns "------" as I checked with byebug. Also, my post /guess is still empty!

  post '/guess' do
    letter = params[:guess].to_s[0]
    ### YOUR CODE HERE ###
    flash[:message]="You have already used that letter." if not @game.word.include?(letter)
    redirect '/show'
  end
    Given I start a new game with word "animal"             # features/step_definitions/game_steps.rb:12

[47, 56] in /home/user/edx/agile_dev_basics/hw-sinatra-saas-hangperson/lib/hangperson_game.rb
 # def word_with_guesses
   47: 	dashed_word=@word.clone
   48: 	dashed_word.each_char do |l|
   49: 		dashed_word.gsub! l,"-" if not guesses.include?(l)
   50: 	end
   51:         byebug
=> 52: 	dashed_word
   53:   end
   54: 
   55:   def check_win_or_lose
   56: 	return :win if not word_with_guesses.include? ("-")
(byebug) "------"
(byebug)     When I guess "a"                                        # features/step_definitions/game_steps.rb:19
    Then I should see "a---a-" within "span.word"           # features/step_definitions/game_steps.rb:71

Kind regards.

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