summaryrefslogtreecommitdiffstats
path: root/spec/system/new_statuses_spec.rb
blob: 6faed6c808c30c310ef714b4de030f27c77e605a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true

require 'rails_helper'

describe 'NewStatuses' do
  include ProfileStories

  subject { page }

  let(:email)               { 'test@example.com' }
  let(:password)            { 'password' }
  let(:confirmed_at)        { Time.zone.now }
  let(:finished_onboarding) { true }

  before do
    as_a_logged_in_user
    visit root_path
  end

  it 'can be posted' do
    expect(subject).to have_css('div.app-holder')

    status_text = 'This is a new status!'

    within('.compose-form') do
      fill_in "What's on your mind?", with: status_text
      click_on 'Publish!'
    end

    expect(subject).to have_selector('.status__content__text', text: status_text)
  end

  it 'can be posted again' do
    expect(subject).to have_css('div.app-holder')

    status_text = 'This is a second status!'

    within('.compose-form') do
      fill_in "What's on your mind?", with: status_text
      click_on 'Publish!'
    end

    expect(subject).to have_selector('.status__content__text', text: status_text)
  end
end