2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
require 'spec_helper'
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
RSpec.describe 'User deletes snippet', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:content) { 'puts "test"' }
|
2021-01-03 14:25:43 +05:30
|
|
|
let(:snippet) { create(:personal_snippet, :repository, :public, content: content, author: user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit snippet_path(snippet)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'deletes the snippet' do
|
2021-01-03 14:25:43 +05:30
|
|
|
expect(page).to have_content(snippet.title)
|
|
|
|
|
|
|
|
click_button('Delete')
|
|
|
|
click_button('Delete snippet')
|
|
|
|
wait_for_requests
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_content(snippet.title)
|
|
|
|
end
|
|
|
|
end
|