Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorVinnie Okada <vokada@mrvinn.com>2015-02-20 06:53:05 +0300
committerVinnie Okada <vokada@mrvinn.com>2015-02-20 06:53:05 +0300
commit9e9ce95d62ec4feb76c3ec238dd3189c781f40ce (patch)
tree28939e566ce29a278cd7ae15e37266aa6a16a17c /spec
parent76aad9b76ed756ca9ba2cbcdb399c815e542b3ae (diff)
parentde040ffaaef4ad5ebd93b3f7a237add438dbddd5 (diff)
Merge branch 'master' into rails-4.1.9
Conflicts: app/views/dashboard/_project.html.haml app/views/events/event/_common.html.haml app/views/explore/projects/_project.html.haml app/views/groups/_projects.html.haml app/views/projects/_home_panel.html.haml app/views/projects/_issues_nav.html.haml app/views/projects/issues/_discussion.html.haml app/views/projects/issues/_issues.html.haml app/views/projects/issues/show.html.haml app/views/projects/merge_requests/_discussion.html.haml app/views/projects/merge_requests/_show.html.haml app/views/projects/milestones/index.html.haml app/views/projects/notes/_edit_form.html.haml app/views/shared/_issuable_filter.html.haml
Diffstat (limited to 'spec')
-rw-r--r--spec/features/notes_on_merge_requests_spec.rb2
-rw-r--r--spec/helpers/gitlab_markdown_helper_spec.rb14
-rw-r--r--spec/requests/api/internal_spec.rb3
-rw-r--r--spec/requests/api/projects_spec.rb4
-rw-r--r--spec/support/test_env.rb34
5 files changed, 38 insertions, 19 deletions
diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb
index 5c8b1f5be36..c47368b1fda 100644
--- a/spec/features/notes_on_merge_requests_spec.rb
+++ b/spec/features/notes_on_merge_requests_spec.rb
@@ -81,7 +81,7 @@ describe 'Comments' do
within("#note_#{note.id}") do
expect(find('.current-note-edit-form', visible: true)).to be_visible
expect(find('.note-edit-form', visible: true)).to be_visible
- expect(find(:css, '.note-text', visible: false)).not_to be_visible
+ expect(find(:css, '.note-body > .note-text', visible: false)).not_to be_visible
end
end
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb
index 2caeb0dd856..68269ad25a8 100644
--- a/spec/helpers/gitlab_markdown_helper_spec.rb
+++ b/spec/helpers/gitlab_markdown_helper_spec.rb
@@ -584,7 +584,7 @@ describe GitlabMarkdownHelper do
it "should leave code blocks untouched" do
allow(helper).to receive(:user_color_scheme_class).and_return(:white)
- target_html = "<pre class=\"code highlight white plaintext\"><code>some code from $40\nhere too\n</code></pre>\n"
+ target_html = "<pre class=\"code highlight white plaintext\"><code>some code from $#{snippet.id}\nhere too\n</code></pre>\n"
expect(helper.markdown("\n some code from $#{snippet.id}\n here too\n")).
to eq(target_html)
@@ -638,6 +638,18 @@ describe GitlabMarkdownHelper do
expect(markdown(actual)).to match(expected)
end
+ it "should handle relative urls for a file in master with an anchor" do
+ actual = "[GitLab API doc](doc/api/README.md#section)\n"
+ expected = "<p><a href=\"/#{project.path_with_namespace}/blob/#{@ref}/doc/api/README.md#section\">GitLab API doc</a></p>\n"
+ expect(markdown(actual)).to match(expected)
+ end
+
+ it "should not handle relative urls for the current file with an anchor" do
+ actual = "[GitLab API doc](#section)\n"
+ expected = "<p><a href=\"#section\">GitLab API doc</a></p>\n"
+ expect(markdown(actual)).to match(expected)
+ end
+
it "should handle relative urls for a directory in master" do
actual = "[GitLab API doc](doc/api)\n"
expected = "<p><a href=\"/#{project.path_with_namespace}/tree/#{@ref}/doc/api\">GitLab API doc</a></p>\n"
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index 10b467d85fd..4c7d15d6594 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -32,7 +32,8 @@ describe API::API, api: true do
it do
get api("/internal/broadcast_message"), secret_token: secret_token
- expect(response.status).to eq(404)
+ expect(response.status).to eq(200)
+ expect(json_response).to be_empty
end
end
end
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 170ede57310..0b3a47e3273 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -347,7 +347,7 @@ describe API::API, api: true do
end
describe 'GET /projects/:id/events' do
- before { project_member }
+ before { project_member2 }
it 'should return a project events' do
get api("/projects/#{project.id}/events", user)
@@ -356,7 +356,7 @@ describe API::API, api: true do
expect(json_event['action_name']).to eq('joined')
expect(json_event['project_id'].to_i).to eq(project.id)
- expect(json_event['author_username']).to eq(user.username)
+ expect(json_event['author_username']).to eq(user3.username)
end
it 'should return a 404 error if not found' do
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index 1c150cbfe25..f869488d8d8 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -22,16 +22,7 @@ module TestEnv
# Disable mailer for spinach tests
disable_mailer if opts[:mailer] == false
- # Clean /tmp/tests
- tmp_test_path = Rails.root.join('tmp', 'tests')
-
- if File.directory?(tmp_test_path)
- Dir.entries(tmp_test_path).each do |entry|
- unless ['.', '..', 'gitlab-shell', factory_repo_name].include?(entry)
- FileUtils.rm_r(File.join(tmp_test_path, entry))
- end
- end
- end
+ clean_test_path
FileUtils.mkdir_p(repos_path)
@@ -50,15 +41,30 @@ module TestEnv
allow_any_instance_of(NotificationService).to receive(:mailer).and_call_original
end
+ # Clean /tmp/tests
+ #
+ # Keeps gitlab-shell and gitlab-test
+ def clean_test_path
+ tmp_test_path = Rails.root.join('tmp', 'tests', '**')
+
+ Dir[tmp_test_path].each do |entry|
+ unless File.basename(entry) =~ /\Agitlab-(shell|test)\z/
+ FileUtils.rm_rf(entry)
+ end
+ end
+ end
+
def setup_gitlab_shell
- `rake gitlab:shell:install`
+ unless File.directory?(Rails.root.join(*%w(tmp tests gitlab-shell)))
+ `rake gitlab:shell:install`
+ end
end
def setup_factory_repo
clone_url = "https://gitlab.com/gitlab-org/#{factory_repo_name}.git"
unless File.directory?(factory_repo_path)
- system(*%W(git clone #{clone_url} #{factory_repo_path}))
+ system(*%W(git clone -q #{clone_url} #{factory_repo_path}))
end
Dir.chdir(factory_repo_path) do
@@ -79,7 +85,7 @@ module TestEnv
end
# We must copy bare repositories because we will push to them.
- system(*%W(git clone --bare #{factory_repo_path} #{factory_repo_path_bare}))
+ system(*%W(git clone -q --bare #{factory_repo_path} #{factory_repo_path_bare}))
end
def copy_repo(project)
@@ -101,7 +107,7 @@ module TestEnv
end
def factory_repo_path_bare
- factory_repo_path.to_s + '_bare'
+ "#{factory_repo_path}_bare"
end
def factory_repo_name