notes_on_wall_spec.rb 1.12 KB
Newer Older
1 2 3 4 5 6 7
require 'spec_helper'

describe "On the project wall", js: true do
  let!(:project) { create(:project) }

  before do
    login_as :user
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
8
    project.team << [@user, :master]
9
    visit project_wall_path(project)
10 11 12 13 14
  end

  subject { page }

  describe "the note form" do
15 16 17
    it { should have_css(".wall-note-form", visible: true, count: 1) }
    it { find(".wall-note-form input[type=submit]").value.should == "Add Comment" }
    it { within(".wall-note-form") { should have_unchecked_field("Notify team via email") } }
18 19 20

    describe "with text" do
      before do
21
        within(".wall-note-form") do
22 23 24 25
          fill_in "note[note]", with: "This is awesome"
        end
      end

26
      it { within(".wall-note-form") { should_not have_css(".js-comment-button[disabled]") } }
27 28 29 30 31
    end
  end

  describe "when posting a note" do
    before do
32
      within(".wall-note-form") do
33 34 35 36 37
        fill_in "note[note]", with: "This is awsome!"
        click_button "Add Comment"
      end
    end

38
    it { should have_content("This is awsome!") }
39
    it { within(".wall-note-form") { should have_no_field("note[note]", with: "This is awesome!") } }
40 41
  end
end