Sha256: 2d4b8a05cf6f84fbe617ca5bd521a336c70440e32c8679f15aa72104a0489782

Contents?: true

Size: 1005 Bytes

Versions: 15

Compression:

Stored size: 1005 Bytes

Contents

# frozen_string_literal: true

shared_examples_for Quby::Questionnaires::Entities::Charting::Chart do
  it 'initializes with a key and options' do
    expect(described_class.new(:tot, title: "My Title")).to be
  end

  it 'coerces keys to be symbols' do
    expect(described_class.new('tot').key).to eq :tot
  end

  it 'has plottables' do
    score1, score2 = double, double
    expect(described_class.new(:tot, plottables: [score1, score2]).plottables).to eq [score1, score2]
  end

  describe '#y_range' do
    it 'returns the y_range' do
      expect(described_class.new('chart', y_range: 100..200).y_range).to eq(100..200)
    end

    describe 'when y_categories is given and no y_range is given' do
      it 'returns 0..(y_categories.count - 1)' do
        expect(described_class.new('chart', y_categories: %w(Bad Great Best)).y_range).to eq(0..2)
      end
    end
  end

  it 'defaults y_range_categories to nil' do
    expect(described_class.new('test').y_range_categories).to eq(nil)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
quby-5.0.1 spec/support/examples_for_chart.rb
quby-5.0.0 spec/support/examples_for_chart.rb
quby-4.0.4 spec/support/examples_for_chart.rb
quby-5.0.0.pre4 spec/support/examples_for_chart.rb
quby-5.0.0.pre3 spec/support/examples_for_chart.rb
quby-5.0.0.pre2 spec/support/examples_for_chart.rb
quby-5.0.0.pre1 spec/support/examples_for_chart.rb
quby-4.0.3 spec/support/examples_for_chart.rb
quby-4.0.2 spec/support/examples_for_chart.rb
quby-4.0.1 spec/support/examples_for_chart.rb
quby-4.0.0 spec/support/examples_for_chart.rb
quby-3.2.2 spec/support/examples_for_chart.rb
quby-3.2.1 spec/support/examples_for_chart.rb
quby-3.2.0 spec/support/examples_for_chart.rb
quby-3.2.0.pre.pre1 spec/support/examples_for_chart.rb