diff options
author | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-01-06 01:58:36 +0400 |
---|---|---|
committer | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-01-06 01:58:36 +0400 |
commit | 8c604c9d31561dc364173626923d568bf76414ba (patch) | |
tree | 34cd3ed117a0e8fc27161e49062a3c69eb761869 /spec | |
parent | 1883e0830cb9a8803e98059c9f4c6c82b55c5d84 (diff) |
Add specs for notes on wall
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/notes_on_wall_spec.rb | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/spec/requests/notes_on_wall_spec.rb b/spec/requests/notes_on_wall_spec.rb new file mode 100644 index 00000000000..b42d293f9d6 --- /dev/null +++ b/spec/requests/notes_on_wall_spec.rb @@ -0,0 +1,86 @@ +require 'spec_helper' + +describe "On the project wall", js: true do + let!(:project) { create(:project) } + let!(:commit) { project.commit("bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a") } + + before do + login_as :user + project.add_access(@user, :read, :write) + + visit wall_project_path(project) + end + + subject { page } + + describe "the note form" do + # main target form creation + it { should have_css(".js-main-target-form", visible: true, count: 1) } + + # button initalization + it { within(".js-main-target-form") { should have_button("Add Comment") } } + it { within(".js-main-target-form") { should_not have_link("Cancel") } } + + # notifiactions + it { within(".js-main-target-form") { should have_checked_field("Project team") } } + it { within(".js-main-target-form") { should_not have_checked_field("Commit author") } } + it { within(".js-main-target-form") { should_not have_unchecked_field("Commit author") } } + + describe "without text" do + it { within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) } } + end + + describe "with text" do + before do + within(".js-main-target-form") do + fill_in "note[note]", with: "This is awesome" + end + end + + it { within(".js-main-target-form") { should_not have_css(".js-comment-button[disabled]") } } + + it { within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: true) } } + end + + describe "with preview" do + before do + within(".js-main-target-form") do + fill_in "note[note]", with: "This is awesome" + find(".js-note-preview-button").trigger("click") + end + end + + it { within(".js-main-target-form") { should have_css(".js-note-preview", text: "This is awesome", visible: true) } } + + it { within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) } } + it { within(".js-main-target-form") { should have_css(".js-note-edit-button", visible: true) } } + end + end + + describe "when posting a note" do + before do + within(".js-main-target-form") do + fill_in "note[note]", with: "This is awsome!" + find(".js-note-preview-button").trigger("click") + click_button "Add Comment" + end + end + + # note added + it { within(".js-main-target-form") { should have_content("This is awsome!") } } + + # reset form + it { within(".js-main-target-form") { should have_no_field("note[note]", with: "This is awesome!") } } + + # return from preview + it { within(".js-main-target-form") { should have_css(".js-note-preview", visible: false) } } + it { within(".js-main-target-form") { should have_css(".js-note-text", visible: true) } } + + + it "should be removable" do + find(".js-note-delete").trigger("click") + + should_not have_css(".note") + end + end +end |