Skip to content

Passes the test with a wrong behaviour  #61

Open
@abdellani

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions