Sha256: c9c31112ff3394ac300f94364c6540710a9a1451c8fa5529b87c0e54471d2fa6

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'
require 'rails_helper'

describe Chartnado::Helpers::Chart, type: :helper do
  def works?(&block)
    expect {
      block.call
    }.not_to raise_exception
  end

  describe "#area_chart" do
    it "supports the dsl" do
      works? { helper.area_chart { {1 => 2} / 2.0 } }
    end

    describe "with a custom renderer" do
      it "calls the custom renderer" do
        wrapper_proc = proc { throw :wrapper_was_called }
        expect {
          expect(controller).to receive(:chartnado_options).and_return({wrapper_proc: wrapper_proc})
          helper.area_chart { {1 => 2} / 2.0 }
        }.to throw_symbol :wrapper_was_called
      end
    end
  end

  describe "#stacked_area_chart" do
    it "supports the dsl" do
      works? { helper.stacked_area_chart { {1 => 2} / 2.0 } }
    end
    describe "percentage option" do
    end
  end

  describe "#pie_chart" do
    it "supports the dsl" do
      works? { helper.pie_chart { {1 => 2} / 2.0 } }
    end
  end

  describe "#geo_chart" do
    it "supports the dsl" do
      works? { helper.geo_chart { {1 => 2} / 2.0 } }
    end
  end

  describe "#line_chart" do
    it "supports the dsl" do
      works? { helper.line_chart { {1 => 2} / 2.0 } }
    end
    xit "includes total"
    describe "percentage option" do
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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