BigW Consortium Gitlab

user_deletes_snippet_spec.rb 407 Bytes
Newer Older
1 2
require 'rails_helper'

3
feature 'User deletes snippet' do
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
  let(:user) { create(:user) }
  let(:content) { 'puts "test"' }
  let(:snippet) { create(:personal_snippet, :public, content: content, author: user) }

  before do
    sign_in(user)

    visit snippet_path(snippet)
  end

  it 'deletes the snippet' do
    first(:link, 'Delete').click

    expect(page).not_to have_content(snippet.title)
  end
end