test/unit/report/test_internal.rb in thinreports-0.7.6 vs test/unit/report/test_internal.rb in thinreports-0.7.7
- old
+ new
@@ -18,10 +18,14 @@
def sample_layout2
data_file('basic_layout2.tlf')
end
+ def sample_list_layout
+ data_file('basic_list_layout.tlf')
+ end
+
def test_layout_specified_in_new_method_should_be_defined_as_default_layout
internal = Report::Internal.new(report, :layout => sample_layout1)
assert_equal internal.default_layout.filename, sample_layout1
end
@@ -66,10 +70,19 @@
internal = Report::Internal.new(report, {})
assert_instance_of ThinReports::Layout::Configuration,
internal.register_layout(sample_layout1)
end
+
+ def test_register_layout_should_be_able_to_set_list_configuration_without_errors
+ internal = Report::Internal.new(report, {})
+ internal.register_layout(sample_list_layout) do |config|
+ config.list(:list).use_stores :foo => 0
+ config.list(:list).use_stores :bar => 1000
+ end
+ pass
+ end
def test_add_page_should_finalize_the_current_page
layout = ThinReports::Layout.new(sample_layout1)
internal = Report::Internal.new(report, :layout => sample_layout1)
@@ -215,10 +228,18 @@
def test_load_layout_with_unknown_id
internal = Report::Internal.new(report, {})
assert_nil internal.load_layout(:unknown)
end
+ def test_load_layout_should_set_default_layout_when_default_layout_is_nil
+ internal = Report::Internal.new(report, {})
+ internal.load_layout(sample_layout1)
+
+ assert_equal internal.default_layout.filename,
+ sample_layout1
+ end
+
def test_load_layout_should_raise_error_when_invalid_value_set
internal = Report::Internal.new(report, {})
assert_raises ThinReports::Errors::LayoutFileNotFound do
internal.load_layout('/path/to/unkown.tlf')
@@ -243,5 +264,6 @@
internal.copy_page
assert_equal internal.page_count, 2
end
end
+