hotwire 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +0,0 @@
1
- require 'test_helper'
2
-
3
- class TestColumnHeaders < Test::Unit::TestCase
4
- context "a Hotwire::ColumnHeaders instance" do
5
- setup do
6
- time = Time.utc(2010, 10, 19, 9, 38, 10)
7
- @headers = Hotwire::ColumnHeaders.new({:columns => ['started at', 'name', 'years', 'location'], :rows => [[time, "bob", 21, nil]]})
8
- end
9
-
10
- context "to_wire" do
11
- should "return a propperly formatted array" do
12
- expected = [{"type"=>"datetime", "id"=>"started at", "label"=>"Started at"},
13
- {"type"=>"string", "id"=>"name", "label"=>"Name"},
14
- {"type"=>"number", "id"=>"years", "label"=>"Years"},
15
- {"type"=>"string", "id"=>"location", "label"=>"Location"}]
16
- assert_equal expected, @headers.to_wire
17
- end
18
- end
19
- end
20
- end
@@ -1,26 +0,0 @@
1
- require 'test_helper'
2
-
3
- class TestCoreExtensions < Test::Unit::TestCase
4
- context "a Hash" do
5
- context "to_wire" do
6
- context "with propper data" do
7
- setup do
8
- time = Time.local(2010, 10, 19, 9, 38, 10)
9
- @hash = {:columns => ['started at', 'name', 'years', 'location'], :rows => [[time, "bob", 21, nil]]}
10
- end
11
-
12
- should "return a propperly formatted hash" do
13
- expected = { "table"=> { "rows"=> [ {"c"=> [{"v"=>"Date(2010, 9, 19, 9, 38, 10)"},
14
- {"v"=>"bob"},
15
- {"v"=>21},
16
- {"v"=>0}]}],
17
- "cols"=> [{"type"=>"datetime", "id"=>"started at", "label"=>"Started at"},
18
- {"type"=>"string", "id"=>"name", "label"=>"Name"},
19
- {"type"=>"number", "id"=>"years", "label"=>"Years"},
20
- {"type"=>"string", "id"=>"location", "label"=>"Location"}]}}
21
- assert_equal expected, @hash.to_wire
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,17 +0,0 @@
1
- require 'test_helper'
2
-
3
- class TestRow < Test::Unit::TestCase
4
- context "a Hotwire::Row instance" do
5
- setup do
6
- time = Time.local(2010, 10, 19, 9, 38, 10)
7
- @row = Hotwire::Row.new([time, "value1", nil])
8
- end
9
-
10
- context "to_wire" do
11
- should "return a propperly formatted hash" do
12
- expected = { 'c' => [{ 'v' => "Date(2010, 9, 19, 9, 38, 10)" }, { 'v' => "value1" }, { 'v' => 0 } ] }
13
- assert_equal expected, @row.to_wire
14
- end
15
- end
16
- end
17
- end
@@ -1,40 +0,0 @@
1
- require 'test_helper'
2
-
3
- class TestTable < Test::Unit::TestCase
4
- context "inializing from a Hash" do
5
-
6
- should "raise an ArgumentError if :columns are not specified" do
7
- assert_raise ArgumentError do
8
- Hotwire::Table.new({:rows => []})
9
- end
10
- end
11
-
12
- should "raise an ArgumentError if :rows are not specified" do
13
- assert_raise ArgumentError do
14
- Hotwire::Table.new({:columns => []})
15
- end
16
- end
17
-
18
- end
19
-
20
- context "a Hotwire::Date instance" do
21
- setup do
22
- time = Time.local(2010, 10, 19, 9, 38, 10)
23
- @data = Hotwire::Table.new({:columns => ['started at', 'name', 'years', 'location'], :rows => [[time, "bob", 21, nil]]})
24
- end
25
-
26
- context "to_wire" do
27
- should "return a properly formatted hash" do
28
- expected = { "table"=> { "rows"=> [ {"c"=> [{"v"=>"Date(2010, 9, 19, 9, 38, 10)"},
29
- {"v"=>"bob"},
30
- {"v"=>21},
31
- {"v"=>0}]}],
32
- "cols"=> [{"type"=>"datetime", "id"=>"started at", "label"=>"Started at"},
33
- {"type"=>"string", "id"=>"name", "label"=>"Name"},
34
- {"type"=>"number", "id"=>"years", "label"=>"Years"},
35
- {"type"=>"string", "id"=>"location", "label"=>"Location"}]}}
36
- assert_equal expected, @data.to_wire
37
- end
38
- end
39
- end
40
- end