Sha256: 0af1dd3f304bf621b862e7c58dde12dd434657b2a2ea77ed3ebba2f7caa3e5f6

Contents?: true

Size: 1.94 KB

Versions: 4

Compression:

Stored size: 1.94 KB

Contents

require 'spec_helper'

describe GenomerPluginView do

  describe "#fetch_view" do

    it "should return the required view plugin class" do
      GenomerPluginView.fetch_view('fasta').should == GenomerPluginView::Fasta
    end

  end

  describe "#run" do

    let(:example) do
      GenomerPluginView::Example = Class.new(GenomerPluginView)
    end

    before do
      mock(described_class).fetch_view('example') do
        example
      end
    end

    it "should initialize and run the required view plugin" do
      mock.proxy(example).new([:arg],:flags) do |instance|
        mock(instance).run
      end

      described_class.new(['example',:arg],:flags).run
    end

  end

  describe '#convert_command_line_flags' do

    subject do
      described_class.convert_command_line_flags(flags)
    end

    describe "with no command line arguments" do

      let(:flags) do
        {}
      end

      it "should return an empty hash" do
        subject.should == {}
      end

    end

    describe "with an unrelated command line argument" do

      let(:flags) do
        {:something => :unknown}
      end

      it "should return an empty hash" do
        subject.should == {}
      end

    end

    describe "with the prefix command line argument" do

      let(:flags) do
        {:prefix => 'pre_'}
      end

      it "should return the prefix argument" do
        subject.should == {:prefix => 'pre_'}
      end

    end

    describe "with the generate_encoded_features command line argument" do

      let(:flags) do
        {:'generate_encoded_features' => true}
      end

      it "should return the prefix argument" do
        subject.should == {:encoded => true}
      end

    end

    describe "with the reset_locus_numbering command line argument" do

      let(:flags) do
        {:reset_locus_numbering => true}
      end

      it "should map this to the the reset argument" do
        subject.should == {:reset => true}
      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
genomer-plugin-view-0.0.5 spec/genomer-view-plugin_spec.rb
genomer-plugin-view-0.0.4 spec/genomer-view-plugin_spec.rb
genomer-plugin-view-0.0.3 spec/genomer-view-plugin_spec.rb
genomer-plugin-view-0.0.2 spec/genomer-view-plugin_spec.rb