Sha256: 38ebed00548f62cab530c7cb23a9dcf5fa3ba01a959db7116f7cfc8b777869e6

Contents?: true

Size: 1.85 KB

Versions: 14

Compression:

Stored size: 1.85 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "example_helper.rb"))

module HtmlReportHelperSpec
  # Is there an idiom for this?
  def self.included(base)
    base.before do
      @reporter = Object.new
      @reporter.extend Relevance::Tarantula::HtmlReportHelper
    end                                                                   
  end 
end

describe 'Relevance::Tarantula::HtmlReportHelper#wrap_in_line_number_table' do
  include HtmlReportHelperSpec
  it "can wrap text in a table row used for displaying lines and line numbers" do
    html = @reporter.wrap_in_line_number_table_row("Line 1\nLine 2")
    html.should == <<-END.strip
<tr><td class=\"numbers\"><span class=\"line number\">1</span><span class=\"line number\">2</span></td><td class=\"lines\"><span class=\"line\">Line 1</span><span class=\"line\">Line 2</span></td></tr>
END
  end  
end

describe 'Relevance::Tarantula::HtmlReportHelper#wrap_stack_trace_line' do
  include HtmlReportHelperSpec
  it "can wrap stack trace line in links" do                       
    line = %{/action_controller/filters.rb:697:in `call_filters'}
    @reporter.stubs(:textmate_url).returns("ide_url")
    html = @reporter.wrap_stack_trace_line(line)
    html.should == "<a href='ide_url'>/action_controller/filters.rb:697</a>:in `call_filters'"
  end  
  
  it "converts html entities for non-stack trace lines" do
    line = %{<a href="foo">escape me</a>}
    html = @reporter.wrap_stack_trace_line(line)
    html.should == %{&lt;a href=&quot;foo&quot;&gt;escape me&lt;/a&gt;}
  end

end

describe 'Relevance::Tarantula::HtmlReportHelper IDE help' do
  include HtmlReportHelperSpec
  it "can create a textmate url" do
    @reporter.stubs(:rails_root).returns("STUB_RAILS_ROOT")
    @reporter.textmate_url("/etc/somewhere", 100).should =~ %r{txmt://open\?url=.*/STUB_RAILS_ROOT/etc/somewhere&line_no=100}
  end
end

Version data entries

14 entries across 14 versions & 5 rubygems

Version Path
relevance-tarantula-0.1.6 examples/relevance/tarantula/html_report_helper_example.rb
relevance-tarantula-0.1.7 examples/relevance/tarantula/html_report_helper_example.rb
relevance-tarantula-0.1.8 examples/relevance/tarantula/html_report_helper_example.rb
relevance-tarantula-0.2.0 examples/relevance/tarantula/html_report_helper_example.rb
relevance-tarantula-0.2.1 examples/relevance/tarantula/html_report_helper_example.rb
relevance-tarantula-0.3.2 examples/relevance/tarantula/html_report_helper_example.rb
relevance-tarantula-0.3.3 examples/relevance/tarantula/html_report_helper_example.rb
romanbsd-tarantula-0.1.8 examples/relevance/tarantula/html_report_helper_example.rb
romanbsd-tarantula-0.2.0 examples/relevance/tarantula/html_report_helper_example.rb
tarantula-rails3-0.3.3 examples/relevance/tarantula/html_report_helper_example.rb
panmind-tarantula-0.3.3 examples/relevance/tarantula/html_report_helper_example.rb
tarantula-0.3.3 examples/relevance/tarantula/html_report_helper_example.rb
tarantula-0.2.0 examples/relevance/tarantula/html_report_helper_example.rb
tarantula-0.1.8 examples/relevance/tarantula/html_report_helper_example.rb