2014-04-28 46 views
0

我有一個規範文件:的Rails 3 + Rspec的:Rspec的說,檢測正在進行,但他們應該路過

require 'spec_helper' 

describe Search do 
    it should { respond_to(:theme_ids) } 
    it should { respond_to(:imprint_ids) } 
    it should { respond_to(:language_ids) } 
    it should { respond_to(:award_ids) } 
    it should { respond_to(:dra) } 
    it should { respond_to(:intervention) } 
    it should { respond_to(:guided_reading) } 
    it should { respond_to(:lexile) } 
    it should { respond_to(:accel_bot) } 
    it should { respond_to(:accel_top) } 
    it should { respond_to(:interest_low) } 
    it should { respond_to(:interest_high) } 
end 

而且我在app /模型/ search.rb寫了一個類

​​

它可以在控制檯:

1.9.3-p484 :002 > Search.new({h: 1}) 
    => {} 

然而,當我跑我的測試中,他們都懸而未決:

Nets-Mac-Pro:mysite emai$ be rspec spec/models/search_spec.rb 
    /Users/emai/.rvm/gems/[email protected]/gems/ruby-debug-ide-0.4.18/lib/ruby-debug-ide/command.rb:27: warning: already initialized constant DEF_OPTIONS 
    ************ 

    Pending: 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ec5798> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:4 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ec4ac8> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:5 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ecc728> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:6 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ecb968> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:7 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ecb008> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:8 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701eca4c8> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:9 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ec9c30> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:10 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ec9488> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:11 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ed0fd0> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:12 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ed0788> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:13 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ed0148> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:14 
     Search #<RSpec::Matchers::BuiltIn::PositiveOperatorMatcher:0x007ff701ecfa40> 
     # Not yet implemented 
     # ./spec/models/search_spec.rb:15 

    Finished in 0.4977 seconds 
    12 examples, 0 failures, 12 pending 
    Nets-Mac-Pro:mysite emai$ 

發生了什麼事?

回答

2

在你的例子

it should { respond_to(:theme_ids) } 

應該

it { should respond_to(:theme_ids) } 

改變所有的例子相似。必須在傳遞給it方法的塊內調用should

+0

....哇我是一個白癡謝謝 – Edmund

+0

很高興幫助。當超時結束時,請接受答案:) –

+0

Rspec總是很漂亮... –

相關問題