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

Got up to here on weekend challenge: RPS #2133

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

BenjaminNeustadt
Copy link

No description provided.

We can now grab the rules of the Rock Paper Scissors game and use it in
our game, or at the "main" or "global" space.

Currently, this is at the global level.
We should not have personal choice things in the project gitignore.
They belong in the developers personal "global" excludes file instead.
Copy link

@raphaella-rose raphaella-rose left a comment

Choose a reason for hiding this comment

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

Using more tests to drive your code may help you know which direction to go in. I thought your code was easy to read. :)

subject(:player) { Player.new('Player') }
subject(:computer) { Player.new('Computer') }

describe '#name' do

Choose a reason for hiding this comment

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

This is a good initial test for the player class

views/name.erb Outdated
@@ -0,0 +1,6 @@
We will now ask you for your name.

Choose a reason for hiding this comment

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

This is straight forward and easy to understand :)

controller.rb Outdated
end

post '/assign_name' do
@player = Player.new(params[:name])

Choose a reason for hiding this comment

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

You could use a session to store the player name

require File.join(File.dirname(__FILE__), .., app.rb) in the spec_helper:
rspec now passing correctly. enabled session in controller, stored instance variable in controller
[started again with tests this time]

User Story 1

As a marketeer
So that I can see my name in lights
I would like to register my name before playing an online game
As a marketeer
So I can play a game
I want to see the shapes I can play

made minimum adjustments necessary to pass rspec test. hardcoded the
words "Rock" "Paper" "Scissors" to the erb files.
 # As a marketeer
  # So I can play a game
  # I want to choose a shape to play

created instance variable @shape and used sessions to store it with
params[:shape].

This is possible because in the <form> we give to
name="shape". Params are passed in the form of hash. Provide a way for
information to be passed from a user to your application. Params are
used to allow interactivity on a website, for example by allowing form
data to be sent.
As a marketeer
So I can play a game
I want the game to choose an option

FUN FACT: normal methods can be written into the test file.Capybara has
methods not only to match something on the page but also retrieve element from page and see
the contents of the element.CF method inside the play_spec file.
As a marketeer
So I can play a game
I want the game to choose a random option

Used srand to get pseudo random number that we put into a seed at the
beginning in a constant.
For this created an object Turn, and used options on that object to
refer to different types of objects within that.
End Game.
Implemented logic in model
Added necessary 'require' for the models held in lib folder.
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

Successfully merging this pull request may close these issues.

None yet

2 participants