Using action text, I have a model named drill
with
app/models/drill.rb
class drill
has_rich_text :content
end
I have a form to use the trix editor
<%= form_for @drill do |f| %>
<div class="field">
<%= f.label :content %>
<%= f.rich_text_area :content %>
</div>
<%= f.submit "Update", class: 'btn btn-primary' %>
<% end -%>
This produces a space to enter text, with the label 'Content', an input with id of drill_content_trix_input_drill
, a trix-editor
element with an id of drill_content
. In the rspec feature spec, I have tried
it 'fills the content field', js: true do
...
fill_in 'drill_content_trix_input_drill', with: 'Do full swing very slowly'
end
but this gives
Capybara::ElementNotFound:
Unable to find field "drill_content_trix_input_drill" that is not disabled
I have also tried fill_in 'Content'
and fill_in 'drill_content'
but saw a similar error. How do I fix this?