Sha256: 53d5f342d542ae4bb585baf02cf14668a928d338f059a996126f7e0a966d8193

Contents?: true

Size: 878 Bytes

Versions: 15

Compression:

Stored size: 878 Bytes

Contents

shared_examples_for "guard command" do |info|

  def set_run_on_option info
    # run_on_change -> change
    # run_all -> all
    run_option = info[:command].to_s.match(/(.*_)?(\w+)/)[2].to_sym
    options[:run_on] = [run_option]
  end

  it "should execute #{info[:command]} when said so" do
    set_run_on_option info
    subject.should_receive(:compile_assets)
    subject.send(info[:command])
  end
  it "should not execute #{info[:command]} when disabled" do
    options[:run_on] = [:something_other]
    subject.should_not_receive(:compile_assets)
    subject.send(info[:command])
  end

  it "should #{info[:run] ? '' : 'not '}execute #{info[:command]} by default" do
    options[:run_on] = nil
    if info[:run]
      subject.should_receive(:compile_assets)
    else
      subject.should_not_receive(:compile_assets)
    end
    subject.send(info[:command])
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
guard-rails-assets-0.1.5 spec/support/shared_examples.rb
guard-rails-assets-0.1.4 spec/support/shared_examples.rb
guard-rails-assets-0.1.3 spec/support/shared_examples.rb
guard-rails-assets-0.1.2 spec/support/shared_examples.rb
guard-rails-assets-0.1.1 spec/support/shared_examples.rb
guard-rails-assets-0.1.0 spec/support/shared_examples.rb
guard-rails-assets-0.0.9 spec/support/shared_examples.rb
guard-rails-assets-0.0.8 spec/support/shared_examples.rb
guard-rails-assets-0.0.7 spec/support/shared_examples.rb
guard-rails-assets-0.0.6 spec/support/shared_examples.rb
guard-rails-assets-0.0.5 spec/support/shared_examples.rb
guard-rails-assets-0.0.4 spec/support/shared_examples.rb
guard-rails-assets-0.0.3 spec/support/shared_examples.rb
guard-rails-assets-0.0.2 spec/support/shared_examples.rb
guard-rails-assets-0.0.1 spec/support/shared_examples.rb