Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command to run rspec system specs #583

Open
chrislawrence opened this issue Mar 6, 2022 · 3 comments
Open

Command to run rspec system specs #583

chrislawrence opened this issue Mar 6, 2022 · 3 comments

Comments

@chrislawrence
Copy link

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.

@tpope
Copy link
Owner

tpope commented Mar 6, 2022

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.

@chrislawrence
Copy link
Author

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

@tpope
Copy link
Owner

tpope commented Mar 11, 2022

Probably adding another section like this will be sufficient:

vim-rails/autoload/rails.vim

Lines 4430 to 4438 in de73f6d

\ "spec/features/*_spec.rb": {
\ "template": [
\ "require 'rails_helper'",
\ "",
\ "RSpec.describe \"{underscore|capitalize|blank}\", type: :feature do",
\ "end"
\ ],
\ "type": "integration test"
\ },

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants