vim-rails icon indicating copy to clipboard operation
vim-rails copied to clipboard

Command to run rspec system specs

Open chrislawrence opened this issue 3 years ago • 3 comments
trafficstars

Rspec system specs have largely replaced feature specs for high end testing. It would be nice to have an :Esystem command to edit these specs.

chrislawrence avatar Mar 06 '22 08:03 chrislawrence

I'm out of the loop on this. What's the naming scheme? What should the template look like?

Based on precedent, we probably want to further overload this onto :Eintegrationtest.

tpope avatar Mar 06 '22 21:03 tpope

naming scheme is spec/system/widget_system_spec.rb

template is:

require "rails_helper"

RSpec.describe "Widget management", :type => :system do
  before do
    driven_by(:rack_test)
  end

  it "enables me to create widgets" do
    visit "/widgets/new"

    fill_in "Name", :with => "My Widget"
    click_button "Create Widget"

    expect(page).to have_text("Widget was successfully created.")
  end
end

From https://relishapp.com/rspec/rspec-rails/docs/system-specs/system-spec

chrislawrence avatar Mar 11 '22 02:03 chrislawrence

Probably adding another section like this will be sufficient:

https://github.com/tpope/vim-rails/blob/de73f6d1b0bf1b2af2d576f3420fc861af14769f/autoload/rails.vim#L4430-L4438

For templates we strive for the smallest possible, no example tests or anything like that. One can use the generator to get those.

tpope avatar Mar 11 '22 19:03 tpope