私はプログラミングにかなり慣れておらず(3か月)、TDDを介して学習しようとしています。
明らかに、TDDのポイントは、最初にテストケースを作成することです。この特定の部分は、方法がわかりませんでした。
コードスニペットは次のとおりです。
class PhraseFactory
def initialize
@sentence = ''
end
def make_sentences_from
for i in 0 ... self.length
@sentence += self[i] + ' '
end
end
私がそれをテストすることをどのように考えていたか:
describe "When sent a message(<< is that proper terminology?) from an array of strings"
it "Builds a sentence"
my_word_array.should_have (here is where I am unclear)sent_a_message_to(make_sentences_from)
助けてくれてありがとう。