Sha256: b7d1162db283daa8e72aeb9f0099489f4d28adf2f7870bcc2c8a94446688610c

Contents?: true

Size: 1016 Bytes

Versions: 8

Compression:

Stored size: 1016 Bytes

Contents

module Spec
  module Helpers

    def reset!
      FileUtils.rm_rf(File.expand_path('../../../site', __FILE__))
    end

    def remove_logs
      FileUtils.rm_rf(File.expand_path('../../fixtures/default/log', __FILE__))
    end

    def clone_site
      VCR.use_cassette('pull') do
        Locomotive::Wagon.clone('site', '.', { host: 'sample.example.com:3000', email: 'admin@locomotivecms.com', password: 'locomotive' })
      end
    end

    def run_server
      path = 'spec/fixtures/default'
      Locomotive::Wagon::Logger.setup(path, false)
      reader = Locomotive::Mounter::Reader::FileSystem.instance
      reader.run!(path: path)
      Locomotive::Wagon::Server.new(reader, disable_listen: true)
    end

    def open_in_browser
      path = File.join(File.dirname(__FILE__), '..', 'tmp', "wagon-#{Time.new.strftime("%Y%m%d%H%M%S")}#{rand(10**10)}.html")
      FileUtils.mkdir_p(File.dirname(path))
      File.open(path,'w') { |f| f.write last_response.body }
      Launchy.open(path)
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
locomotivecms_wagon-1.5.1 spec/support/helpers.rb
locomotivecms_wagon-1.5.0 spec/support/helpers.rb
locomotivecms_wagon-1.5.0.rc1 spec/support/helpers.rb
locomotivecms_wagon-1.4.0 spec/support/helpers.rb
locomotivecms_wagon-1.3.3 spec/support/helpers.rb
locomotivecms_wagon-1.3.2 spec/support/helpers.rb
locomotivecms_wagon-1.3.1 spec/support/helpers.rb
locomotivecms_wagon-1.3.0 spec/support/helpers.rb