Sha256: 0b6dcfbca878594f44ccb37ed971799d9111de290b74ee3d2bffd57191ec553f

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

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

describe GenomerPluginSummary::Scaffold do

  describe "#tabulate" do

    subject do
      described_class.new([],{}).tabulate(data) + "\n"
    end

    context "passed table data" do

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

      it do
        should ==<<-EOS.unindent!
      +--------------+-----------+
      |         Scaffold         |
      +--------------+-----------+
      | 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

1 entries across 1 versions & 1 rubygems

Version Path
genomer-plugin-summary-0.0.3 spec/genomer-plugin-summary_spec/scaffold_spec.rb