Sha256: 551eb7a92771168865ccad297d3a33b8f6a20b3005c365290202a11e18203001

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

require "test_helper"

class Replication::Modules::SemiConservativeTest < ActiveSupport::TestCase

  def setup
    Organism.extend Replication::Process
  end

  def organism_object
    Organism.new(name: 'Bacteria', number_of_legs: 1, birth_date: Time.now)
  end

  test "unwound with default options" do
    Organism.can_replicate
    organism = organism_object
    strand = organism.unwound(name: 'First bacteria')

    assert_equal organism.strand_attributes, strand.pairs
  end

  test "replicate with default options" do
    Organism.can_replicate
    organism = organism_object
    strand = organism.replicate(name: 'First bacteria')

    assert_equal organism.strand_attributes, strand.pairs
  end

  test "unwound with whitelist" do
    Organism.can_replicate only: [:name]
    organism = organism_object
    strand = organism.replicate(name: 'First bacteria')

    assert_equal ({ name: 'Bacteria' }), strand.pairs
  end

  test "unwound with blacklist" do
    Organism.can_replicate except: [:id, :number_of_legs, :birth_date, :created_at, :updated_at]
    organism = organism_object
    strand = organism.replicate(name: 'First bacteria')

    assert_equal ({ name: 'Bacteria' }), strand.pairs
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
replication-0.2.0 test/replication/modules/semi_conservative_test.rb