thoughtbot / shoulda-context

Shoulda Context makes it easy to write understandable and maintainable tests under Minitest and Test::Unit within Rails projects or plain Ruby projects.
MIT License
239 stars 58 forks source link

context/should not support Rails 5 run single test example with a line number. #55

Closed zw963 closed 6 years ago

zw963 commented 8 years ago

Rails add new function which can run test included the line number.

/test/jobs/bid_goods_item_expired_job_test.rb:13

But this not worked if use like following:

class CalculatorTest < Test::Unit::TestCase
  context "a calculator" do
    setup do
      @calculator = Calculator.new
    end

    should "add two numbers for the sum" do
      assert_equal 4, @calculator.sum(2, 2)
    end

    should "multiply two numbers for the product" do
      assert_equal 10, @calculator.product(2, 5)
    end
  end
end

Rails 5.0.0

shoulda (3.5.0)
  shoulda-context (~> 1.0, >= 1.0.1)
  shoulda-matchers (>= 1.4.1, < 3.0)
shoulda-context (1.2.1)
shoulda-matchers (2.8.0)

shoulda (~> 3.5) shoulda-matchers (~> 2.0)

bundle config:

group :test do
  gem 'shoulda', '~> 3.5'
  gem 'shoulda-matchers', '~> 2.0'
end
zw963 commented 7 years ago

Current Rails 5.0.2.

shoulda version:

 ╰─ $ cat Gemfile.lock |grep shoulda
    shoulda (3.5.0)
      shoulda-context (~> 1.0, >= 1.0.1)
      shoulda-matchers (>= 1.4.1, < 3.0)
    shoulda-context (1.2.2)
    shoulda-matchers (2.8.0)
  shoulda
  shoulda-matchers

Seem like if number aligned or within a should block is worked! But, if number aligned with a `context', it not worked.

rmacklin commented 6 years ago

For future readers, this issue was fixed in shoulda-context v1.2.2, via https://github.com/thoughtbot/shoulda-context/pull/51

zw963 commented 6 years ago

Current no condition to test this, anyway, thanks.