Skip to content
Browse files

Merge branch 'tests-run-without-pdfkit-or-rmagick-installed' of https…

…://github.com/alexch/showoff into alexch-tests-run-without-pdfkit-or-rmagick-installed

Conflicts:
	test/basic_test.rb
  • Loading branch information...
2 parents 5469645 + c6413f9 commit 93ee8c4e068244fda2b2579b05f3cc2fc80dce9f @goncalossilva goncalossilva committed
Showing with 18 additions and 8 deletions.
  1. +8 −6 test/basic_test.rb
  2. +10 −2 test/utils_test.rb
View
14 test/basic_test.rb
@@ -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
View
12 test/utils_test.rb
@@ -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
@@ -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

0 comments on commit 93ee8c4

Please sign in to comment.
Something went wrong with that request. Please try again.