spec/admino/table/presenter_spec.rb in admino-0.0.4 vs spec/admino/table/presenter_spec.rb in admino-0.0.5

- old
+ new

@@ -9,24 +9,19 @@ let(:query) { double('Query') } let(:view) { RailsViewContext.new } let(:collection) { [ first_post, second_post ] } let(:first_post) { Post.new('1') } - let(:first_post_presenter) { double('PresentedPost', dom_id: 'post_1') } let(:second_post) { Post.new('2') } - let(:second_post_presenter) { double('PresentedPost', dom_id: 'post_2') } let(:head_row) { double('HeadRow', to_html: '<td id="thead_td"></td>'.html_safe) } let(:resource_row) { double('ResourceRow', to_html: '<td id="tbody_td"></td>'.html_safe) } before do - PostPresenter.stub(:new).with(first_post, view).and_return(first_post_presenter) - PostPresenter.stub(:new).with(second_post, view).and_return(second_post_presenter) - HeadRow.stub(:new).with(Post, query, view).and_return(head_row) - ResourceRow.stub(:new).with(first_post_presenter, view).and_return(resource_row) - ResourceRow.stub(:new).with(second_post_presenter, view).and_return(resource_row) + ResourceRow.stub(:new).with(first_post, view).and_return(resource_row) + ResourceRow.stub(:new).with(second_post, view).and_return(resource_row) end describe '#.to_html' do let(:result) { presenter.to_html } @@ -76,11 +71,11 @@ it 'calls it once passing the HeadRow instance' do expect(block_call_args[0]).to eq [head_row, nil] end it 'calls it once for each collection member passing the ResourceRow instance and the member itself' do - expect(block_call_args[1]).to eq [resource_row, first_post_presenter] - expect(block_call_args[2]).to eq [resource_row, second_post_presenter] + expect(block_call_args[1]).to eq [resource_row, first_post] + expect(block_call_args[2]).to eq [resource_row, second_post] end end context 'custom table HTML options' do let(:presenter_klass) do