fix tests. added jquery.timeago.js

This commit is contained in:
Dmitriy Zaporozhets 2013-03-19 14:39:32 +02:00
parent 124a5e270e
commit b1bd3f1252
14 changed files with 247 additions and 82 deletions

View file

@ -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"

View file

@ -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")

View file

@ -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

View file

@ -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 }