2014-12-23 33 views
1

我有一個類:IntelliJ IDEA的可能不檢測described_class的方法,規格

class A 

    def foo 
    1 
    end 

    def self.bar 
    2 
    end 

end 

我已經做了規範它:

describe A do 

    describe '#foo' do 
    expect(subject.foo).to eq 1 
    end 

    describe '::bar' do 
    expect(described_class.bar).to eq 2 
    end 

end 

我用的IntelliJ IDEA 14紅寶石插件,但我認爲RubyMine也是如此。 當我鍵入subject.時,自動完成工作並提供方法foo。但對於described_class.它不起作用。我認爲它應該提供方法bar

同樣的問題適用於點擊次數。當我點擊foosubject.foo時,我被重定向到正確的方法。但是當我點擊bardescribed_class.bar時,將執行全文搜索,併爲我提供所有具有該名稱的類中的所有方法。

我錯過了什麼,或者它是IDEA中的錯誤?

回答

1

這是Ruby插件中的一個錯誤(或者說是一個缺失的功能);其代碼洞察對describe_class方法沒有任何特別的認識。

我無法爲此問題找到現有的YouTrack問題,因此歡迎您到file your own

+0

我創建了一個問題:https://youtrack.jetbrains.com/issue/RUBY-16131 – mirelon