Commit 8b6cae2bf61a77b5140fb5be9e27ff1f0fde850d

Authored by Anton Minin
1 parent bbae66ff
Exists in master

Spec for the hostname

spec/lib/airbrake_api/v3/notice_parser_spec.rb
... ... @@ -91,6 +91,14 @@ describe AirbrakeApi::V3::NoticeParser do
91 91 expect(parser.attributes[:notifier]).to eq(notifier_params)
92 92 end
93 93  
  94 + it 'takes the hostname from the context' do
  95 + parser = described_class.new(
  96 + 'errors' => ['MyError'],
  97 + 'context' => { 'hostname' => 'app01.infra.example.com', 'url' => 'http://example.com/some-page' },
  98 + 'environment' => {})
  99 + expect(parser.attributes[:server_environment]['hostname']).to eq('app01.infra.example.com')
  100 + end
  101 +
94 102 def build_params_for(fixture, options = {})
95 103 json = Rails.root.join('spec', 'fixtures', fixture).read
96 104 data = JSON.parse(json)
... ...