Sha256: 706c408ab6d0f88a9cdb1bcb131046da2c2c60af98bdbee262ccfe466421b5c7

Contents?: true

Size: 693 Bytes

Versions: 2

Compression:

Stored size: 693 Bytes

Contents

require 'test_helper'

class DeadweightTest < Test::Unit::TestCase
  def setup
    @dw = Deadweight.new
    @dw.log_file = 'test.log'
    @dw.root = File.dirname(__FILE__) + '/fixtures'
    @dw.stylesheets << '/style.css'
    @dw.pages << '/index.html'

    @result = @dw.run
  end

  should "report unused selectors" do
    assert @result.include?('#foo .bar .baz')
  end

  should "not report used selectors" do
    assert !@result.include?('#foo')
    assert !@result.include?('#foo .bar')
  end

  should "accept Procs as targets" do
    @dw.mechanize = true

    @dw.pages << proc {
      fetch('/index.html')
      agent.page.links.first.click
    }

    assert @dw.run.empty?
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aanand-deadweight-0.0.1 test/deadweight_test.rb
aanand-deadweight-0.0.2 test/deadweight_test.rb