Sha256: 8ac200c7ffee16908186bfc962a35e4aebb55fae504829d66683b3a832d31123

Contents?: true

Size: 909 Bytes

Versions: 3

Compression:

Stored size: 909 Bytes

Contents

require 'spec_helper'
require 'rails_helper'

describe Chartnado::Helpers::Series, type: :helper do
  let(:test_class) {
    Class.new do
      include Chartnado::Helpers::Series
    end
  }

  describe ".define_series" do
    it "lets the user define a series using the chartnado dsl" do
      test_class.class_eval do
        define_series :my_series do
          {0 => 1} / 2
        end
      end
      expect(test_class.new.my_series).to eq({0 => 0.5})
    end
  end
  describe ".define_multiple_series" do
    it "lets the user define multiple series using the chartnado dsl" do
      test_class.class_eval do
        define_multiple_series(
          my_first_series: -> { {0 => 1} / 2 },
          my_second_series: -> { {1 => 1} / 2 }
        )
      end
      expect(test_class.new.my_first_series).to eq({0 => 0.5})
      expect(test_class.new.my_second_series).to eq({1 => 0.5})
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chartnado-0.1.0 spec/helpers/series_helper_spec.rb
chartnado-0.0.2 spec/helpers/series_helper_spec.rb
chartnado-0.0.1 spec/helpers/series_helper_spec.rb