Sha256: 68b13b45a99e9ff2e72bc1b02af97b9b388f25a66af1ef799ee44506fdd04308

Contents?: true

Size: 1.76 KB

Versions: 3

Compression:

Stored size: 1.76 KB

Contents

require_relative '../helper_no_rails'

class RailsDataExplorer
  describe Exploration do

    let(:exploration) {
      Exploration.new(
        'the title',
        [{ name: 'ds1', values: [1,2,3] }],
        true
      )
    }
     it 'computes a dom id' do
      exploration.dom_id.must_match /rde-exploration-./
    end

    # describe "integration test" do

    #   def check_render_expectations(rendered_string, options)
    #     r = true

    #     if options[:has_charts]
    #       options[:has_charts].each { |chart_name|
    #         # TODO: use Nokogiri to test that it is a div class
    #         rendered_string.must_match(
    #           Regexp.new(Regexp.escape("rde-#{ chart_name }"))
    #         )
    #       }
    #     end

    #     r
    #   end

    #   [
    #     [
    #       ['Univariate Integer data', [1, 2, 3]],
    #       { has_charts: ['histogram-quantitative', 'descriptive-statistics-table'] }
    #     ],
    #     [
    #       ['Univariate Decimal data', [1.0, 2.0, 3.0]],
    #       { has_charts: ['histogram-quantitative', 'descriptive-statistics-table'] }
    #     ],
    #     [
    #       ['Univariate Temporal data', [DateTime.new(2015,2,7)]],
    #       { has_charts: ['histogram-temporal', 'descriptive-statistics-table'] }
    #     ],
    #     [
    #       ['Univariate Categorical data', ['a', 'b', 'c']],
    #       { has_charts: ['histogram-categorical', 'pie-chart', 'descriptive-statistics-table'] }
    #     ],
    #   ].each { |(args, xpect_options)|
    #     title, data_set_or_array, chart_specs = args

    #     it "renders #{ title } correctly" do
    #       check_render_expectations(
    #         Exploration.new(*args, true).render,
    #         xpect_options
    #       )
    #     end

    #   }

    # end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails-data-explorer-1.0.4 spec/rails_data_explorer/exploration_spec.rb
rails-data-explorer-1.0.3 spec/rails_data_explorer/exploration_spec.rb
rails-data-explorer-1.0.2 spec/rails_data_explorer/exploration_spec.rb