Is it possible -- or even sane -- to verify that specific parts of the asset pipeline are available in specific layouts of a Rails app?
I'm setting up a new Rails 4.2 app with Twitter Bootstrap 4 (incl. its dependencies such as Tether), FontAwesome and DataTables. The scaffold is working fine so far.
As the whole thing is kind of a training on web development, self-control (w.r.t. software development, i.e. actually stick to a balanced mix of TDD and BDD), I want to make sure to test almost everything that could possibly go wrong.
That includes the availability of all the framework stuff mentioned above on all end points where it's required.
Ultimately, I want to write something of the following:
describe 'layouts/application.html.erb', type: :layout, js: true do
it 'has jQuery' do
render
expect(render).to have_js :jquery
end
it 'has TWBS v4' do
render
expect(render).to have_js :twbs4
expect(render).to have_css :twbs4
end
end
Obviously, these .to have_js :jquery
and .to have_{js,css} :twbs4
need to have something in the background such as a Javascript evaluation of $.fn.jquery
.
Is it even sane to test such things?
Aucun commentaire:
Enregistrer un commentaire