module Middleman::Presentation::Helpers::Test
Test
helpers
Public Class Methods
temporary_fixture_path(name)
click to toggle source
# File lib/middleman-presentation-helpers/test_helpers.rb, line 14 def temporary_fixture_path(name) File.expand_path("../../../tmp/fixtures/#{name}", __FILE__) end
Public Instance Methods
ci?()
click to toggle source
Helpers
for tests
# File lib/middleman-presentation-helpers/test_helpers.rb, line 10 def ci? ENV.key?('CI') || ENV.key?('TRAVIS') end
create_presentation(name, title, date)
click to toggle source
# File lib/middleman-presentation-helpers/test_helpers.rb, line 22 def create_presentation(name, title, date) directory = [] directory << name directory << ('-' + title) directory << ('-' + date) if date directory = directory.join.characterize command = [] command << "middleman-presentation create presentation #{temporary_fixture_path(directory)}" command << "--title #{Shellwords.escape(title)}" command << "--date #{Shellwords.escape(date)}" if date system(command.join(' ')) unless temporary_fixture_exist?(directory) FileUtils.cp_r temporary_fixture_path(directory), absolute_path(name) end
temporary_fixture_exist?(name)
click to toggle source
# File lib/middleman-presentation-helpers/test_helpers.rb, line 18 def temporary_fixture_exist?(name) File.exist? File.expand_path("../../../tmp/fixtures/#{name}", __FILE__) end
Private Instance Methods
temporary_fixture_path(name)
click to toggle source
# File lib/middleman-presentation-helpers/test_helpers.rb, line 14 def temporary_fixture_path(name) File.expand_path("../../../tmp/fixtures/#{name}", __FILE__) end