spec/admino/table/resource_row_spec.rb in admino-0.0.9 vs spec/admino/table/resource_row_spec.rb in admino-0.0.10

- old
+ new

@@ -51,10 +51,25 @@ before { row.column(:title, class: 'title') } it 'uses it to build attributes' do should have_tag(:td, with: { class: 'title' }) end + + context 'with a class that implements a <action_name>_html_options' do + let(:row) { row_subclass.new(resource, view) } + let(:row_subclass) do + Class.new(ResourceRow) do + def column_html_options(action_name) + { class: 'attribute' } + end + end + end + + it 'renders them as attributes' do + should have_tag(:td, with: { class: 'attribute title' }) + end + end end end describe '#actions' do context 'block given' do @@ -176,17 +191,21 @@ context 'with a class that implements a <action_name>_html_options' do let(:row) { row_subclass.new(resource, view) } let(:row_subclass) do Class.new(ResourceRow) do - def show_action_html_options + def action_html_options(action_name) { class: 'button' } end + + def show_action_html_options + { class: 'show-button' } + end end end it 'renders them as attributes' do - should have_tag(:a, with: { class: 'foo button' }) + should have_tag(:a, with: { class: 'foo show-button button' }) end end end context 'with block' do