Sha256: 61aa5763a96e391b4349195ebd41190a03f40692af16dce1ffa0dce11bc23a2e

Contents?: true

Size: 1.75 KB

Versions: 2

Compression:

Stored size: 1.75 KB

Contents

require 'spec_helper'
require 'genomer-plugin-summary/genome'

describe GenomerPluginSummary::Genome do

  describe "#tabulate" do

    subject do
      described_class.new([],{}).tabulate(data,flags)
    end

    let(:data) do
      [['Contigs (#)',1.0],
        :separator,
          ['Gaps (#)',0]]
    end

    context "passed table data" do

      let(:flags) do
        {}
      end

      it do
        should ==<<-EOS.unindent!
      +--------------+-----------+
      |         Scaffold         |
      +--------------+-----------+
      | Contigs (#)  |      1.00 |
      +--------------+-----------+
      | Gaps (#)     |         0 |
      +--------------+-----------+
        EOS
      end

    end

    context "passed table with the format option" do

      let(:flags) do
        {:output => 'csv'}
      end

      it do
        should ==<<-EOS.unindent!
          contigs_#,1.00
          gaps_#,0
        EOS
      end
    end
  end

  describe "#calculate_metrics" do

    subject do
      described_class.new([],{}).calculate_metrics(specs,scaffold)
    end

    context "should calculate a single metrics for the scaffold" do

      let(:scaffold) do
        [sequence('ATGC')]
      end

      let(:specs) do
        [{:name => 'Contigs (%)',  :entry_type => :sequence,   :method => :percent}]
      end

      it do
        should == [['Contigs (%)',100.0]]
      end
    end

    context "should calculate a single metrics with separators" do

      let(:scaffold) do
        [sequence('ATGC')]
      end

      let(:specs) do
        [:separator,
         {:name => 'Contigs (%)',  :entry_type => :sequence,   :method => :percent}]
      end

      it do
        should == [
          :separator,
          ['Contigs (%)',100.0]
        ]
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
genomer-plugin-summary-0.0.5 spec/genomer-plugin-summary_spec/genome_spec.rb
genomer-plugin-summary-0.0.4 spec/genomer-plugin-summary_spec/genome_spec.rb