test/unit/report/test_internal.rb in thinreports-0.8.1 vs test/unit/report/test_internal.rb in thinreports-0.8.2

- old
+ new

@@ -120,11 +120,11 @@ assert_equal internal.page_count, 1 end def test_add_page_should_switch_to_a_reference_to_the_current_page layout = Thinreports::Layout.new(sample_layout1) - new_pages = (1..2).inject([]) do |pages, i| + new_pages = (1..2).inject([]) do |pages| pages << Thinreports::Report::Page.new(report, layout) end internal = Report::Internal.new(report, layout: sample_layout1) internal.add_page(new_pages[0]) @@ -139,50 +139,45 @@ def test_add_page_should_dispatch_the_event_page_creation dispatched = false layout = Thinreports::Layout.new(sample_layout1) internal = Report::Internal.new(report, layout: sample_layout1) - internal.events.on(:page_create) {|e| dispatched = true } + internal.events.on(:page_create) { dispatched = true } internal.add_page(Thinreports::Report::Page.new(report, layout)) assert dispatched end def test_add_blank_page_should_not_dispatch_the_event_page_creation dispatched = false - layout = Thinreports::Layout.new(sample_layout1) internal = Report::Internal.new(report, layout: sample_layout1) - internal.events.on(:page_create) {|e| dispatched = true } + internal.events.on(:page_create) { dispatched = true } internal.add_page(Thinreports::Report::BlankPage.new) refute dispatched end def test_add_blank_page_should_not_count_up_the_total_page_count_when_count_is_disabled - layout = Thinreports::Layout.new(sample_layout1) - internal = Report::Internal.new(report, layout: sample_layout1) internal.add_page(Thinreports::Report::BlankPage.new(false)) assert_equal internal.page_count, 0 end def test_add_blank_page_should_count_up_the_total_page_count_when_count_is_enabled - layout = Thinreports::Layout.new(sample_layout1) - internal = Report::Internal.new(report, layout: sample_layout1) internal.add_page(Thinreports::Report::BlankPage.new) assert_equal internal.page_count, 1 end def test_finalize_should_dispatch_the_event_report_generation dispatched = false internal = Report::Internal.new(report, layout: sample_layout1) - internal.events.on(:generate) {|e| dispatched = true } + internal.events.on(:generate) { dispatched = true } internal.finalize assert dispatched end @@ -257,10 +252,10 @@ def test_copy_page_should_add_the_copied_page layout = Thinreports::Layout.new(sample_layout1) internal = Report::Internal.new(report, layout: sample_layout1) - internal.add_page(page = Thinreports::Report::Page.new(report, layout)) + internal.add_page(Thinreports::Report::Page.new(report, layout)) internal.copy_page assert_equal internal.page_count, 2 end end