From 8b6cae2bf61a77b5140fb5be9e27ff1f0fde850d Mon Sep 17 00:00:00 2001 From: Anton Minin Date: Sun, 20 Mar 2016 19:23:19 +0300 Subject: [PATCH] Spec for the hostname --- spec/lib/airbrake_api/v3/notice_parser_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+), 0 deletions(-) diff --git a/spec/lib/airbrake_api/v3/notice_parser_spec.rb b/spec/lib/airbrake_api/v3/notice_parser_spec.rb index 1e59d70..6664720 100644 --- a/spec/lib/airbrake_api/v3/notice_parser_spec.rb +++ b/spec/lib/airbrake_api/v3/notice_parser_spec.rb @@ -91,6 +91,14 @@ describe AirbrakeApi::V3::NoticeParser do expect(parser.attributes[:notifier]).to eq(notifier_params) end + it 'takes the hostname from the context' do + parser = described_class.new( + 'errors' => ['MyError'], + 'context' => { 'hostname' => 'app01.infra.example.com', 'url' => 'http://example.com/some-page' }, + 'environment' => {}) + expect(parser.attributes[:server_environment]['hostname']).to eq('app01.infra.example.com') + end + def build_params_for(fixture, options = {}) json = Rails.root.join('spec', 'fixtures', fixture).read data = JSON.parse(json) -- libgit2 0.21.2