summaryrefslogtreecommitdiff
path: root/spec/features/snippets/create_snippet_spec.rb
blob: cb95e7828dbf9cb9306b14e1970624be27f8b405 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require 'rails_helper'

feature 'Create Snippet', feature: true do
  before do
    login_as :user
    visit new_snippet_path
  end

  scenario 'Authenticated user creates a snippet' do
    fill_in 'personal_snippet_title', with: 'My Snippet Title'
    page.within('.file-editor') do
      find(:xpath, "//input[@id='personal_snippet_content']").set 'Hello World!'
    end

    click_button 'Create snippet'

    expect(page).to have_content('My Snippet Title')
    expect(page).to have_content('Hello World!')
  end
end