thoughtbot/shoulda-context

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

Closed this issue · 3 comments

zw963 commented

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

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.

For future readers, this issue was fixed in shoulda-context v1.2.2, via #51

zw963 commented

Current no condition to test this, anyway, thanks.