Skip to content

Commit

Permalink
Merge branch 'tests-run-without-pdfkit-or-rmagick-installed' of https…
Browse files Browse the repository at this point in the history
…://github.com/alexch/showoff into alexch-tests-run-without-pdfkit-or-rmagick-installed

Conflicts:
	test/basic_test.rb
  • Loading branch information
goncalossilva committed Mar 5, 2012
2 parents 5469645 + c6413f9 commit 93ee8c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
14 changes: 8 additions & 6 deletions test/basic_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ def app
assert_match '<div id="slides"', last_response.body
end

test "can create a pdf version" do
get '/pdf'
assert last_response.ok?, last_response.body =~ /(No wkhtmltopdf executable found)/ ? $1 : 'Unknown error'
if Object.const_defined? :PDFKit
test "can create a pdf version" do
get '/pdf'
assert last_response.ok?, last_response.body =~ /(No wkhtmltopdf executable found)/ ? $1 : 'Unknown error'

pages = PDF::Inspector::Page.analyze(last_response.body).pages.size
assert_equal 2, pages
pages = PDF::Inspector::Page.analyze(last_response.body).pages.size
assert_equal 2, pages

assert last_response.body.size > 5000
assert last_response.body.size > 5000
end
end

end
12 changes: 10 additions & 2 deletions test/utils_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@
content = File.read('static/index.html')
assert_match 'My Presentation', content
assert_equal 2, content.scan(/div class="slide"/).size
assert_match 'img src="./file/one/chacon.jpg" width="300" height="300" alt="chacon"', content
if Object.const_defined? :RMagick
assert_match 'img src="./file/one/chacon.jpg" width="300" height="300" alt="chacon"', content
else
assert_match 'img src="./file/one/chacon.jpg" alt="chacon"', content
end
end
end

Expand All @@ -57,7 +61,11 @@
content = `git cat-file -p gh-pages:index.html`
assert_match 'My Presentation', content
assert_equal 2, content.scan(/div class="slide"/).size
assert_match 'img src="./file/one/chacon.jpg" width="300" height="300" alt="chacon"', content
if Object.const_defined? :RMagick
assert_match 'img src="./file/one/chacon.jpg" width="300" height="300" alt="chacon"', content
else
assert_match 'img src="./file/one/chacon.jpg" alt="chacon"', content
end
end
end

Expand Down

0 comments on commit 93ee8c4

Please sign in to comment.