Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't recognize lines in block #53

Open
luikore opened this issue Jun 20, 2011 · 1 comment
Open

Can't recognize lines in block #53

luikore opened this issue Jun 20, 2011 · 1 comment

Comments

@luikore
Copy link

luikore commented Jun 20, 2011

Especially for sinatra applications. Here's a minimal example demonstrating the problem:

app.rb

require "sinatra"

class App < Sinatra::Base
  get '/' do
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    i = 1
    'hi'
  end
end

test.rb

require "test/unit"
require "rack/test"
require "cover_me"
require_relative "app"

CoverMe.config do |c|
  c.project.root = File.expand_path File.dirname(__FILE__)
  c.file_pattern = /app\.rb/
end
at_exit &(CoverMe.method :complete!)

class TestApp < Test::Unit::TestCase
  include Rack::Test::Methods

  def app
    App
  end

  def test_1
    get '/'
    assert_equal 'hi', last_response.body
  end
end

The result shows only 3 lines are covered, all lines in the block are not covered.

Environment:

  • ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.1]
  • sinatra (1.2.6)
  • rack-test (0.6.0)
  • cover_me (1.0.0)
@midwire
Copy link

midwire commented Dec 16, 2011

Same issue here. bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants