From abc6e5f20147dcf3abe9cd91b1aea54ce91265aa Mon Sep 17 00:00:00 2001 From: ainame Date: Wed, 24 Jul 2013 11:07:23 +0900 Subject: [PATCH] bug fix: update_table_data raise error at `on_load` --- lib/ProMotion/table/table.rb | 1 + spec/unit/tables/table_screen_spec.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/ProMotion/table/table.rb b/lib/ProMotion/table/table.rb index d4c0c53..33cca4d 100644 --- a/lib/ProMotion/table/table.rb +++ b/lib/ProMotion/table/table.rb @@ -60,6 +60,7 @@ module ProMotion end def update_table_view_data(data) + create_table_view_from_data(data) unless @promotion_table_data @promotion_table_data.data = data table_view.reloadData end diff --git a/spec/unit/tables/table_screen_spec.rb b/spec/unit/tables/table_screen_spec.rb index 673662f..07bab5f 100644 --- a/spec/unit/tables/table_screen_spec.rb +++ b/spec/unit/tables/table_screen_spec.rb @@ -95,4 +95,21 @@ describe "table screens" do end + describe 'test PM::TableScreen\'s method call order' do + before do + class MethodCallOrderTestTableScreen < PM::TableScreen + def table_data; @table_data ||= []; end + def on_load + @table_data = [{cells: [ title: 'cell 1' ]}] + update_table_data + end + end + end + + it 'should not raise error at load view' do + proc { @screen = MethodCallOrderTestTableScreen.new }.should.not.raise(NoMethodError) + end + end + end +