From b1bd3f1252eb529030f2295e4c2a991158894b64 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 19 Mar 2013 14:39:32 +0200 Subject: fix tests. added jquery.timeago.js --- spec/features/gitlab_flavored_markdown_spec.rb | 2 +- spec/features/notes_on_merge_requests_spec.rb | 4 +- spec/features/notes_on_wall_spec.rb | 60 ++++---------------------- spec/features/security/project_access_spec.rb | 2 +- spec/mailers/notify_spec.rb | 2 +- 5 files changed, 13 insertions(+), 57 deletions(-) (limited to 'spec') diff --git a/spec/features/gitlab_flavored_markdown_spec.rb b/spec/features/gitlab_flavored_markdown_spec.rb index a6485328219..a3ed0d52b72 100644 --- a/spec/features/gitlab_flavored_markdown_spec.rb +++ b/spec/features/gitlab_flavored_markdown_spec.rb @@ -198,7 +198,7 @@ describe "Gitlab Flavored Markdown" do end it "should render in projects#wall", js: true do - visit wall_project_path(project) + visit project_wall_path(project) within ".new_note.js-main-target-form" do fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index 9bef01868db..670762e8005 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -22,7 +22,7 @@ describe "On a merge request", js: true do it { within(".js-main-target-form") { should_not have_link("Cancel") } } # notifiactions - it { within(".js-main-target-form") { should have_checked_field("Notify team via email") } } + it { within(".js-main-target-form") { should have_unchecked_field("Notify team via email") } } it { within(".js-main-target-form") { should_not have_checked_field("Notify commit author") } } it { within(".js-main-target-form") { should_not have_unchecked_field("Notify commit author") } } @@ -127,7 +127,7 @@ describe "On a merge request diff", js: true, focus: true do it { should have_css(".js-close-discussion-note-form", text: "Cancel") } # notification options - it { should have_checked_field("Notify team via email") } + it { should have_unchecked_field("Notify team via email") } it "shouldn't add a second form for same row" do find("#4735dfc552ad7bf15ca468adc3cad9d05b624490_185_185.line_holder .js-add-diff-note-button").trigger("click") diff --git a/spec/features/notes_on_wall_spec.rb b/spec/features/notes_on_wall_spec.rb index 69f35beadae..85151341b02 100644 --- a/spec/features/notes_on_wall_spec.rb +++ b/spec/features/notes_on_wall_spec.rb @@ -2,84 +2,40 @@ require 'spec_helper' describe "On the project wall", js: true do let!(:project) { create(:project) } - let!(:commit) { project.repository.commit("bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a") } before do login_as :user project.team << [@user, :master] - visit wall_project_path(project) + visit project_wall_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 { find(".js-main-target-form input[type=submit]").value.should == "Add Comment" } - it { within(".js-main-target-form") { should_not have_link("Cancel") } } - - # notifiactions - it { within(".js-main-target-form") { should have_checked_field("Notify team via email") } } - it { within(".js-main-target-form") { should_not have_checked_field("Notify commit author") } } - it { within(".js-main-target-form") { should_not have_unchecked_field("Notify commit author") } } - - describe "without text" do - it { within(".js-main-target-form") { should have_css(".js-note-preview-button", visible: false) } } - end + 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") } } describe "with text" do before do - within(".js-main-target-form") do + within(".wall-note-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) } } + it { within(".wall-note-form") { should_not have_css(".js-comment-button[disabled]") } } end end describe "when posting a note" do before do - within(".js-main-target-form") do + within(".wall-note-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 { 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 + it { within(".wall-note-form") { should have_no_field("note[note]", with: "This is awesome!") } } end end diff --git a/spec/features/security/project_access_spec.rb b/spec/features/security/project_access_spec.rb index fd9c2a9b04e..b89844013c3 100644 --- a/spec/features/security/project_access_spec.rb +++ b/spec/features/security/project_access_spec.rb @@ -95,7 +95,7 @@ describe "Application access" do end describe "GET /project_code/wall" do - subject { wall_project_path(project) } + subject { project_wall_path(project) } it { should be_allowed_for master } it { should be_allowed_for reporter } diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index befc10594db..94c4f43d823 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -239,7 +239,7 @@ describe Notify do end describe 'on a project wall' do - let(:note_on_the_wall_path) { wall_project_path(project, anchor: "note_#{note.id}") } + let(:note_on_the_wall_path) { project_wall_path(project, anchor: "note_#{note.id}") } subject { Notify.note_wall_email(recipient.id, note.id) } -- cgit v1.2.3