Sha256: 72f405a884b06a82eb219cb82c8bf88f816ddd2417b56d8162707e73971d7c7e

Contents?: true

Size: 1.6 KB

Versions: 9

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe "employee report" do

  describe "rendering HTML" do

    context "when a custom view exists for the report" do

      it "uses the custom view" do
        get '/reports/employee_with_custom_view'
        expect(response.body).to eq(File.read('spec/fixtures/reports/employee_with_custom_view.html'))
      end

    end

    context "when no custom view exists for the report" do

      it "creates an HTML report using its standard 'show' view" do
        get '/reports/employee'
        expect(response.body).to eq(File.read('spec/fixtures/reports/employee.html'))
      end

      it "uses any options provided" do
        get '/reports/employee', options: {
          salary: true, order: 'desc', 
          names: ['Jimmy Jackalope', 'Moustafa McMann'],
          divisions: ['Tedious Toiling']
        }
        expect(response.body).to eq(File.read('spec/fixtures/reports/employee_with_parameters.html'))
      end

      it "moves the specified number of rows into the footer" do
        get '/reports/employee', options: {
          footer: 1
        }
        expect(response.body).to eq(File.read('spec/fixtures/reports/employee_with_footer.html'))
      end

    end

  end

  describe "rendering CSV" do

    it "creates a standard CSV report" do
      get '/reports/employee.csv'
      expect(response.body).to eq(File.read('spec/fixtures/reports/employee.csv'))
    end

  end

  describe "rendering XLS" do

    it "creates a standard XLS report" do
      get '/reports/employee.xls'
      expect(response.body).to eq(File.read('spec/fixtures/reports/employee.xls'))
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
dossier-2.7.1 spec/requests/employee_spec.rb
dossier-2.7.0 spec/requests/employee_spec.rb
dossier-2.6.0 spec/requests/employee_spec.rb
dossier-2.5.2 spec/requests/employee_spec.rb
dossier-2.5.1 spec/requests/employee_spec.rb
dossier-2.5.0 spec/requests/employee_spec.rb
dossier-2.4.0 spec/requests/employee_spec.rb
dossier-2.3.0 spec/requests/employee_spec.rb
dossier-2.2.0 spec/requests/employee_spec.rb