Sha256: bd12d9d0052fba08df353c032e9e443ea56b63c33293d32ed341d52e6084418e

Contents?: true

Size: 998 Bytes

Versions: 3

Compression:

Stored size: 998 Bytes

Contents

require 'spec_helper'
require 'guard'

module RevealCK
  module Commands
    describe ListenToReloadBrowser do
      describe '#run' do
        it 'works with Guard to setup livereload' do
          serve_ui = double

          expect(serve_ui)
            .to(receive(:prefix_for))
            .and_return('[prefix]')

          output_dir = 'output_dir'

          guardfile_watches_index_html_in_output_dir =
            %r{watch\(\%r\{\^#{output_dir}\/index.html\$\}\)}

          start_args = {
            guardfile_contents: guardfile_watches_index_html_in_output_dir,
            no_interactions: true
          }
          expect(::Guard)
            .to(receive(:start).with(start_args))
            .once

          listen_to_reload_browser =
            ListenToReloadBrowser.new(serve_ui, output_dir)
          thread = listen_to_reload_browser.run
          thread.join

          expect(Guard::UI.options[:template]).to eq '[prefix] :message'
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reveal-ck-4.0.0 spec/lib/reveal-ck/commands/listen_to_reload_browser_spec.rb
reveal-ck-3.9.2 spec/lib/reveal-ck/commands/listen_to_reload_browser_spec.rb
reveal-ck-3.9.1 spec/lib/reveal-ck/commands/listen_to_reload_browser_spec.rb