spec/lib/administrate/field/jsontable_spec.rb in administrate-field-jsontable-0.0.5 vs spec/lib/administrate/field/jsontable_spec.rb in administrate-field-jsontable-0.1.0
- old
+ new
@@ -1,14 +1,25 @@
+# frozen_string_literal: true
+
require 'administrate/field/jsontable'
describe Administrate::Field::Jsontable do
describe '#to_partial_path' do
it 'returns a partial based on the page being rendered' do
- page = :show
- field = Administrate::Field::Jsontable.new(:status, 'status', page)
+ assert_partial_path(page: :show)
+ end
- path = field.to_partial_path
-
- expect(path).to eq("/fields/jsontable/#{page}")
+ it 'returns a partial for index page' do
+ assert_partial_path(page: :index)
end
+ end
+
+ private
+
+ def assert_partial_path(page:)
+ field = Administrate::Field::Jsontable.new(:status, 'status', page)
+
+ path = field.to_partial_path
+
+ expect(path).to eq("/fields/jsontable/#{page}")
end
end