Sha256: 8c7854db499eb929c7281ee7ca174c33d443f6b3c9b9f31c3f219c814de4826c

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

require File.join(File.dirname(__FILE__),'..','..','spec_helper')

describe Scaffolder::Test::Sequence do

  describe "basic instance" do
    subject do
      described_class.new(:name => 'contig1',:sequence => 'ATGCCC')
    end

    its(:name)    {should == 'contig1'}
    its(:sequence){should == 'ATGCCC'}

    its(:to_fasta){should == ">contig1\nATGCCC"}
    its(:to_hash) {should == {'sequence' => {'source' => 'contig1'}} }
  end

  [:start,:stop,:reverse].each do |attribute|

    describe "instance with #{attribute} attribute" do

      let(:value){:value}
      subject do
        described_class.new(:name => 'contig1',:sequence => 'ATGCCC',
                            attribute => value)
      end

      its(:name)    {should == 'contig1'}
      its(:sequence){should == 'ATGCCC'}
      its(attribute){should == value}

      its(:to_fasta){should == ">contig1\nATGCCC"}
      its(:to_hash) do
        should == {'sequence' => {'source' => 'contig1', attribute.to_s => value}}
      end

    end

    describe "chaining instance attributes" do

      let(:value){:value}
      subject do
        instance = described_class.new(:name => 'contig1',:sequence => 'ATGCCC')
        instance.send(attribute,value)
      end

      its(attribute){should == value}

    end

  end

  describe "#clone" do

    it "should also duplicate the internal options state" do
      a = described_class.new(:name => 'contig1',:sequence => 'ATGCCC')
      b = a.clone

      a.instance_variable_get("@options").
        should_not equal(b.instance_variable_get("@options"))
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scaffolder-test-helpers-0.2.2 spec/scaffolder/test/sequence_spec.rb
scaffolder-test-helpers-0.2.1 spec/scaffolder/test/sequence_spec.rb