Commit cbfd2e86 authored by Joe Libipl's avatar Joe Libipl
Browse files

Separate names remembered, and state skip for testing.

parent 87337e94
Pipeline #9177717 passed with stage
in 1 minute and 46 seconds
......@@ -14,6 +14,7 @@ class SMSBeholder < Sinatra::Base
player_data[source]['state'] ||= 'SPLASH'
state = player_data[source]['state']
state = params['SkipToState'] if params.key?('SkipToState')
puts state
# Handle input
......@@ -26,14 +27,14 @@ class SMSBeholder < Sinatra::Base
end
next_state = game_states[state]['next']
response = game_states[state]['story']
response = String.new(game_states[state]['story'])
player_data[source]['last_state'] = state
player_data[source]['state'] = next_state
puts player_data
# Fill in values in response
for key in player_data[source].keys
response.sub!(":#{key}:", player_data[source][key])
response.gsub!(":#{key}:", player_data[source][key])
end
response
end
......
......@@ -37,4 +37,22 @@ describe SMSBeholder do
expect(last_response.body).to include("You're NameOfDude4, a student at Beholder High.")
end
it 'uses the right player name' do
get '/', From: 'Dude5'
get '/', From: 'Dude5', Body: 'NumberFive'
get '/', From: 'Dude6'
get '/', From: 'Dude6'
get '/', From: 'Dude5'
get '/', From: 'Dude5'
expect(last_response.body).to include("You're NumberFive, a student at Beholder High.")
end
it 'lets you skip to a different state for testing' do
get '/', From: 'Dude7', SkipToState: 'D1S107'
expect(last_response.body).to include("Your brooding has distracted you")
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment