Sha256: 5f7b227c6ed0703309884cff9dfecc18e1d36062859fff65d1a5b4389adb6f0f

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

Given /^the scaffold file has the sequences:$/ do |sequences|
  @entries   ||= Array.new
  @sequences ||= Array.new

  sequences.hashes.each do |seq|
    @entries << {'sequence' => {'source' => seq['name']}}
  end
  sequences.hashes.map do |seq|
    @sequences << {:name => seq['name'], :sequence => seq['nucleotides']}
  end
end

Given /^the first scaffold sequence has the inserts:$/ do |inserts|
  sequence = @entries.detect{|s| s.keys.first == 'sequence' }
  sequence['sequence']['inserts'] = (inserts.hashes.map do |insert|
    i = {'source' => insert['name']}
    i['open']  = insert['open'].to_i  if insert['open']
    i['close'] = insert['close'].to_i if insert['close']
    i
  end)
  inserts.hashes.map do |insert|
    @sequences << {:name => insert['name'], :sequence => insert['nucleotides']}
  end
end

When /^creating a scaffolder object$/ do
  @scf_file = write_scaffold_file(@entries)
  @seq_file = write_sequence_file(@sequences)

  @scaffold = Scaffolder.new(YAML.load(File.read(@scf_file)),@seq_file)
end

Then /^the scaffold should contain (.*) sequence entries$/ do |n|
  @scaffold.select{|s| s.entry_type == :sequence}.length.should == n.to_i
end

Then /^the scaffold should contain (.*) insert entries$/ do |n|
  @scaffold.select{|s| s.entry_type == :sequence}.inject(0) do |count,seq|
    count =+ seq.inserts.length
  end.should == n.to_i
end

And /^the scaffold sequence should be (.*)$/ do |sequence|
  generated_sequence = @scaffold.inject(String.new) do |build,entry|
    build << entry.sequence
  end
  generated_sequence.should == sequence
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scaffolder-0.4.3 features/step_definitions/scaffolder_steps.rb
scaffolder-0.4.2 features/step_definitions/scaffolder_steps.rb
scaffolder-0.4.1 features/step_definitions/scaffolder_steps.rb
scaffolder-0.4.0 features/step_definitions/scaffolder_steps.rb