Module: ActiveRecord::ToHtml::Etest

Defined in:
lib/vex/active_record/to_html.rb

Defined Under Namespace

Classes: Data

Instance Method Summary collapse

Instance Method Details

#setupObject


27
28
29
30
31
32
33
34
35
36
# File 'lib/vex/active_record/to_html.rb', line 27

def setup
  Data.lite_table do
    string :name
    string :age
  end

  Data.create! :name => "name", :age => 2

  assert_equal(1, Data.count)
end

#teardownObject


38
39
40
# File 'lib/vex/active_record/to_html.rb', line 38

def teardown
  Data.destroy_all
end

#test_to_htmlObject


42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vex/active_record/to_html.rb', line 42

def test_to_html
  html = <<-HTML
<div class='active-record-to-html-etest-data'>
<div class='age'>2</div>
<div class='id' type="integer">25</div>
<div class='name'>name</div>
</div>
HTML

  assert_equal html, Data.first.to_html
end