kytrinyx/exercism.io — pull request #332 by pck (2013-08-02 13:22:54+00:00)
Title: Extended rna transcription test v2

Hello

I focused on the comparison and type tests and believe they're simpler.

Inheriting DeoxyribonucleicAcidTest from RibonucleicAcidTest might be questionable. But I think this is easier to read from top to bottom.

Just for reference … a sample development session:
```ruby
# test_acid_equals_acid

class RibonucleicAcid
attr_reader :strand
def initialize(strand)
@strand = strand
end

def ==(other)
strand == other.strand
end
end

# test_acid_equals_string
# NoMethodError: undefined method `strand' for "AGC":String

class RibonucleicAcid
# ...
def ==(other)
other == strand
end
end

# test_string_equals_acid
# -"AGC"
# +#

# Either ..

class RibonucleicAcid
# ...
def to_str
strand
end
end

# .. and maybe we should test to_str and to_s in that case, or String
# must be reopened.

# DeoxyribonucleicAcidTest
# test_acid_equals_acid
# NameError: uninitialized constant DeoxyribonucleicAcid

class DeoxyribonucleicAcid < String
end

# test_similarity_of_acid_classes
# Acid classes not similar: one is a String, the other isn't.

RibonucleicAcid = String

# test_rna_conversion_returns_ribonucleic_acid_instance
# NoMethodError: undefined method `to_rna

class DeoxyribonucleicAcid < String
def to_rna
self
end
end

# ...
# Expected "C" to be an instance of String, not DeoxyribonucleicAcid.

class DeoxyribonucleicAcid < String
def to_rna
RibonucleicAcid.new(self)
end
end

# test_transcribes_cytidine_unchanged
# test_transcribes_guanosine_unchanged
# test_transcribes_adenosine_unchanged
# pass

# test_it_transcribes_thymidine_to_uracil
# ...
```