spec/admino/table/resource_row_spec.rb in admino-0.0.12 vs spec/admino/table/resource_row_spec.rb in admino-0.0.13
- old
+ new
@@ -19,19 +19,19 @@
before do
row.column { 'foo' }
end
it 'fills the cell with the block content' do
- should have_tag(:td, text: 'foo')
+ is_expected.to have_tag(:td, text: 'foo')
end
end
context 'if attribute is present' do
before { row.column(:title) }
it 'fills the cell with the attribute value' do
- should have_tag(:td, text: 'Post 1')
+ is_expected.to have_tag(:td, text: 'Post 1')
end
end
context 'if both attribute and block are missing' do
it 'raises an ArgumentError' do
@@ -41,19 +41,19 @@
context 'role attribute' do
before { row.column(:author_name) }
it 'generates a role attribute with the snake-cased name of the attribute' do
- should have_tag(:td, with: { role: 'author-name' })
+ is_expected.to have_tag(:td, with: { role: 'author-name' })
end
end
context 'with HTML options param' do
before { row.column(:title, class: 'title') }
it 'uses it to build attributes' do
- should have_tag(:td, with: { class: 'title' })
+ is_expected.to 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
@@ -63,11 +63,11 @@
end
end
end
it 'renders them as attributes' do
- should have_tag(:td, with: { class: 'attribute title' })
+ is_expected.to have_tag(:td, with: { class: 'attribute title' })
end
end
end
end
@@ -77,17 +77,17 @@
called = false
result = row.actions do
called = true
end
- expect(called).to be_true
+ expect(called).to be_truthy
end
end
context 'no block' do
before do
- row.stub(:action)
+ allow(row).to receive(:action)
end
before do
row.actions(:show, :destroy)
end
@@ -105,11 +105,11 @@
context 'URL' do
context 'with an explicit URL' do
before { row.action(:show, '/') }
it 'generates a link with the specified URL' do
- should have_tag(:a, with: { href: '/' })
+ is_expected.to have_tag(:a, with: { href: '/' })
end
end
context 'with no explicit URL' do
let(:row) { row_subclass.new(resource, view) }
@@ -122,11 +122,11 @@
end
before { row.action(:show) }
it 'uses a method to build the URL (ie. show_url)' do
- should have_tag(:a, with: { href: '/posts/1' })
+ is_expected.to have_tag(:a, with: { href: '/posts/1' })
end
end
context 'with no explicit URL and no action name' do
it 'raises an ArgumentError' do
@@ -143,28 +143,28 @@
context 'td cell' do
before { row.action(:show, '/') }
it 'generates a td cell with actions role' do
- should have_tag(:td, with: { role: 'actions' })
+ is_expected.to have_tag(:td, with: { role: 'actions' })
end
end
context 'link role' do
before { row.action(:show, '/') }
it 'generates a link with role' do
- should have_tag(:a, with: { role: 'show' })
+ is_expected.to have_tag(:a, with: { role: 'show' })
end
end
context 'link text' do
context do
before { row.action(:show, '/') }
it 'generates a link with a titleized attribute' do
- should have_tag(:a, text: 'Show')
+ is_expected.to have_tag(:a, text: 'Show')
end
end
context 'if I18n is set up' do
before do
@@ -175,20 +175,20 @@
end
before { row.action(:show, '/') }
it 'generates a I18n text' do
- should have_tag(:a, text: 'Show post')
+ is_expected.to have_tag(:a, text: 'Show post')
end
end
end
context 'with html options' do
before { row.action(:show, '/', class: 'foo') }
it 'renders them as attributes' do
- should have_tag(:a, with: { class: 'foo' })
+ is_expected.to have_tag(:a, with: { class: 'foo' })
end
context 'with a class that implements a <action_name>_html_options' do
let(:row) { row_subclass.new(resource, view) }
let(:row_subclass) do
@@ -202,21 +202,21 @@
end
end
end
it 'renders them as attributes' do
- should have_tag(:a, with: { class: 'foo show-button button' })
+ is_expected.to have_tag(:a, with: { class: 'foo show-button button' })
end
end
end
context 'with block' do
before do
row.action { 'Foo' }
end
it 'renders it' do
- should have_tag(:td, text: 'Foo')
+ is_expected.to have_tag(:td, text: 'Foo')
end
end
end
end
end