Commit 7397277f authored by Joe Libipl's avatar Joe Libipl
Browse files

Minimal test

parent 0ba393fe
Pipeline #8748350 failed with stage
in 1 minute and 45 seconds
source 'https://rubygems.org'
gem 'rubocop'
gem 'rubocop-rspec'
gem 'sinatra'
group :test, :development do
gem 'rack-test'
gem 'rspec'
gem 'rubocop'
gem 'rubocop-rspec'
end
require 'sinatra/base'
class SMSBeholder < Sinatra::Base
player_states = {}
get '/' do
source = params['From']
if player_states.has_key?(source)
"Welcome back #{source}"
else
player_states[source] = 0
"Welcome to Beholder High! You're from #{source}!"
end
end
run! if app_file == $0
end
\ No newline at end of file
require 'spec_helper'
require 'rack/test'
require_relative '../sms_beholder.rb'
describe SMSBeholder do
include Rack::Test::Methods
def app
SMSBeholder.new
end
it 'responds with initial state' do
get '/'
expect(last_response.body).to include('Welcome to Beholder High')
end
it 'says welcome back the second time' do
get '/', From: 'Dude'
get '/', From: 'Dude'
expect(last_response.body).to include('Welcome back')
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