Busy Monday
Today was a busy day at the Travis CI office. Not only did Sebastian and Gareth make an appearence (they’ve been out of town over summer), but Julia and Carolina (aka RGSoC Team D*) came to work in the office.
We spent the morning looking through our completed Sinatra tests and editing the names of any test descriptions that weren’t very clear. In some cases this required reminding ourselves of what the test actually did. Carla earn’t herself a 15% More Fun forehead sticker by exploring what params[:agent] returned in the test below (it ‘captures’ the relevant part of the User-Agent header, which in this case is ‘World’).
context 'makes captures in user agent pattern available in params[:agent]' do
let(:app) do
Sinatra.new do
user_agent(/Baz (.*)/)
get('/foo'){'Hello ' + params[:agent].first}
end
end
it "get /foo & HTTP_USER_AGENT = Foo Bar returns correct body" do
response = get '/foo', {}, {'HTTP_USER_AGENT' => 'Baz World'}
expect(response.body).to be == "Hello World"
end
end
She was happy - especially as she remembered what a ‘capture’ in a regular expression was. (Matt explained it last week. It’s about identifying what the important part to identify is, which you indicate by surrounding with brackets).
Work continued into the afternoon.
Then Konstantin returned from his adventures in North America. We were excited to see him and hear about the french-fry sandwiches his colleagues in Pittsburgh fed him.
We also liked his unequivocal praise (naturlich):