Class: TestCurrentWord

Inherits:
MiniTest::Test
  • Object
show all
Defined in:
/Users/martyn/cw/cw_clone/test/test_current_word.rb

Constant Summary

ROOT =
File.expand_path File.dirname(__FILE__) + '/../'

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



13
14
15
# File '/Users/martyn/cw/cw_clone/test/test_current_word.rb', line 13

def setup
  @word = CWG::CurrentWord.new
end

- (Object) teardown



17
18
19
# File '/Users/martyn/cw/cw_clone/test/test_current_word.rb', line 17

def teardown
  @word = nil
end

- (Object) test_clear



40
41
42
43
44
45
# File '/Users/martyn/cw/cw_clone/test/test_current_word.rb', line 40

def test_clear
  @word.push_letter '.'
  assert_equal '.', @word.to_s
  @word.clear
  assert_equal '', @word.to_s
end

- (Object) test_current_word



25
26
# File '/Users/martyn/cw/cw_clone/test/test_current_word.rb', line 25

def test_current_word
end

- (Object) test_initialize



21
22
23
# File '/Users/martyn/cw/cw_clone/test/test_current_word.rb', line 21

def test_initialize
  assert_equal '', @word.to_s
end

- (Object) test_process_letter



54
55
56
57
58
59
60
61
# File '/Users/martyn/cw/cw_clone/test/test_current_word.rb', line 54

def test_process_letter
  @word.process_letter 'A'
  assert_equal 'a', @word.to_s
  @word.process_letter 'z'
  assert_equal 'az', @word.to_s
  @word.process_letter ','
  assert_equal 'az,', @word.to_s
end

- (Object) test_push_letter



28
29
30
31
32
33
# File '/Users/martyn/cw/cw_clone/test/test_current_word.rb', line 28

def test_push_letter
  @word.push_letter 'a'
  assert_equal 'a', @word.to_s
  @word.push_letter '0'
  assert_equal 'a0', @word.to_s
end

- (Object) test_strip



47
48
49
50
51
52
# File '/Users/martyn/cw/cw_clone/test/test_current_word.rb', line 47

def test_strip
  @word.push_letter ' a '
  assert_equal ' a ', @word.to_s
  @word.strip
  assert_equal 'a', @word.to_s
end

- (Object) test_to_s



35
36
37
38
# File '/Users/martyn/cw/cw_clone/test/test_current_word.rb', line 35

def test_to_s
  @word.push_letter '-'
  assert_equal '-', @word.to_s
end