Sha256: bf5199c69e81e70662f57fd6cb0be0a4e178ed4f178f093a3d24f8145e608028

Contents?: true

Size: 557 Bytes

Versions: 4

Compression:

Stored size: 557 Bytes

Contents

require 'spec_helper'

describe 'CspReport create API' do
  it 'should create a report' do
    report = {
      'document-uri' => "http://localhost:3000/home/index",
      'referrer' => "",
      'blocked-uri' => "",
      'violated-directive' => "script-src 'self'",
      'original-policy' => "script-src 'self'; report_uri /csp/csp_reports",
      'incoming-ip' => "127.0.0.1"
    }
    expect {
      post '/csp/csp_reports', 'csp-report' => report
    }.to change(CspReport::CspReport, :count).by(1)

    last_response.status.should eql(200)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
csp_report-1.0.1 spec/api/csp_report_create_spec.rb
csp_report-1.0.0 spec/api/csp_report_create_spec.rb
csp_report-0.4.0 spec/api/csp_report_create_spec.rb
csp_report-0.3.0 spec/api/csp_report_create_spec.rb