Sha256: 529675cf810bf6d9d026f67b4e0ac10f3112f66f2562d8baaecdb4138e605884

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe ReportsKit::Reports::FilterWithSeries do
  subject { described_class.new(filter: filter, series: series) }
  let(:filter) { ReportsKit::Reports::Filter.new(properties) }
  let(:series) { ReportsKit::Reports::Series.new(measure: 'issue', dimensions: %w(repo)) }

  context 'with a datetime filter' do
    let(:properties) { 'opened_at' }

    it 'returns the settings' do
      expect(subject.settings).to eq({ column: 'issues.opened_at' })
    end
  end

  context 'with a belongs_to association filter' do
    let(:properties) { 'repo' }

    it 'returns the settings' do
      expect(subject.settings).to eq({ column: 'issues.repo_id' })
    end
  end

  context 'with a has_many association filter' do
    let(:properties) { 'tags' }

    it 'returns the settings' do
      expect(subject.settings).to eq({ joins: :tags, column: 'tags.id' })
    end
  end

  context 'with a has_many :through association filter' do
    let(:properties) { 'labels' }

    it 'returns the settings' do
      expect(subject.settings).to eq({ joins: :issues_labels, column: 'issues_labels.label_id' })
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
reports_kits-0.7.8 spec/reports_kit/reports/filter_with_series_spec.rb
reports_kits-0.7.7 spec/reports_kit/reports/filter_with_series_spec.rb
reports_kit-0.7.1 spec/reports_kit/reports/filter_with_series_spec.rb
reports_kit-0.7.0 spec/reports_kit/reports/filter_with_series_spec.rb
reports_kit-0.5.0 spec/reports_kit/reports/filter_with_series_spec.rb
reports_kit-0.4.1 spec/reports_kit/reports/filter_with_series_spec.rb
reports_kit-0.4.0 spec/reports_kit/reports/filter_with_series_spec.rb
reports_kit-0.3.3 spec/reports_kit/reports/filter_with_series_spec.rb
reports_kit-0.3.2 spec/reports_kit/reports/filter_with_series_spec.rb
reports_kit-0.3.1 spec/reports_kit/reports/filter_with_series_spec.rb
reports_kit-0.3.0 spec/reports_kit/reports/filter_with_series_spec.rb