Fix setup/teardown for Markdown feature spec

Prior, CI seemed to be freezing after running these specs.
This commit is contained in:
Robert Speicher 2015-07-28 23:27:08 -04:00
parent 05f9a6a9c4
commit 8c957b54f5
2 changed files with 9 additions and 24 deletions

View File

@ -29,22 +29,6 @@ describe 'GitLab Markdown', feature: true do
include GitlabMarkdownHelper include GitlabMarkdownHelper
include MarkdownMatchers include MarkdownMatchers
# Let's only parse this thing once
before(:all) do
@feat = MarkdownFeature.new
# `gfm_with_options` depends on a `@project` variable
@project = @feat.project
end
after(:all) do
@feat.teardown
end
def doc(html = @html)
Nokogiri::HTML::DocumentFragment.parse(html)
end
# Sometimes it can be useful to see the parsed output of the Markdown document # Sometimes it can be useful to see the parsed output of the Markdown document
# for debugging. Call this method to write the output to # for debugging. Call this method to write the output to
# `tmp/capybara/<filename>.html`. # `tmp/capybara/<filename>.html`.
@ -54,6 +38,10 @@ describe 'GitLab Markdown', feature: true do
end end
end end
def doc(html = @html)
Nokogiri::HTML::DocumentFragment.parse(html)
end
# Shared behavior that all pipelines should exhibit # Shared behavior that all pipelines should exhibit
shared_examples 'all pipelines' do shared_examples 'all pipelines' do
describe 'Redcarpet extensions' do describe 'Redcarpet extensions' do
@ -189,6 +177,11 @@ describe 'GitLab Markdown', feature: true do
context 'default pipeline' do context 'default pipeline' do
before(:all) do before(:all) do
@feat = MarkdownFeature.new
# `gfm_with_options` depends on a `@project` variable
@project = @feat.project
@html = markdown(@feat.raw_markdown) @html = markdown(@feat.raw_markdown)
end end

View File

@ -10,14 +10,6 @@
class MarkdownFeature class MarkdownFeature
include FactoryGirl::Syntax::Methods include FactoryGirl::Syntax::Methods
def initialize
DatabaseCleaner.start
end
def teardown
DatabaseCleaner.clean
end
def user def user
@user ||= create(:user) @user ||= create(:user)
end end