-
Notifications
You must be signed in to change notification settings - Fork 250
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
RPS challenge completed #256
Open
KevinByrne
wants to merge
6
commits into
makersacademy:main
Choose a base branch
from
KevinByrne:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bcf4397
index route added to app.rb, views directory added, index.erb file added
KevinByrne 9097d9c
functionality between index route and index.erb working
KevinByrne 43245b5
form html added in index.erb
KevinByrne e5ae5e6
app.rb file updates, features directory updated, views directory updated
KevinByrne ca3c3e7
codebase updated
KevinByrne db94bcb
forced push of erb files
KevinByrne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
require 'sinatra/base' | ||
require 'sinatra/reloader' | ||
require './lib/player' | ||
|
||
|
||
class RockPaperScissors < Sinatra::Base | ||
get '/test' do | ||
'test page' | ||
|
||
get '/' do | ||
erb :index | ||
end | ||
|
||
post '/names' do | ||
$player_1 = Player.new(params[:player_1_name]) | ||
redirect '/play' | ||
end | ||
|
||
get '/play' do | ||
@name1 = $player_1.name | ||
erb :play | ||
end | ||
|
||
run! if app_file == $0 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class Player | ||
attr_reader :name | ||
|
||
def initialize(name) | ||
@name = name | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
feature 'Enter name' do | ||
scenario 'submitting names' do | ||
sign_in_and_play | ||
|
||
save_and_open_page # will save the web page and open the browser to display it | ||
|
||
expect(page).to have_content 'Hello Kev!' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
feature 'see weapons' do | ||
|
||
scenario 'Player can see choice of weapons' do | ||
sign_in_and_play | ||
|
||
expect(page).to have_button("Rock") | ||
expect(page).to have_button("Paper") | ||
expect(page).to have_button("Scissors") | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
def sign_in_and_play | ||
visit('/') | ||
fill_in :player_1_name, with: 'Kev' | ||
click_button 'Submit' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<h1>Rock, Paper, Scissors</h1> | ||
<hr> | ||
<h2>Register for the game</h2> | ||
<br> | ||
<form action="/name" method="post"> | ||
<label for="players_name"> | ||
<h3>Please enter your name:</h3> | ||
<input type="text" name="players_name"> | ||
<label> | ||
<input type="submit" value="Submit"> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<h1>Rock, Paper, Scissors</h1> | ||
<hr> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possible line break typo? |
||
<h2>Welcome <%= @player_name %>!</h2> | ||
<br> | ||
<h3>Choose Rock, Paper or Scissors:<h3> | ||
|
||
<form action="/run_game" method="post"> | ||
<input type="Submit" name="rock-button" value="Rock"> | ||
<input type="Submit" name="paper-button" value="Paper"> | ||
<input type="Submit" name="scissor-button" value="Scissors"> | ||
</form> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Referring to play view, but erb file is play_game.erb which you'd already flagged.