Ruby on rails 轨道3和x2B;Rspec:Rspec说测试正在进行中,但应该通过
我有一个规范文件:Ruby on rails 轨道3和x2B;Rspec:Rspec说测试正在进行中,但应该通过,ruby-on-rails,rspec,Ruby On Rails,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
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/models/search.rb中编写的一个类
class Search
attr_reader :theme_ids, :imprint_ids, :language_ids, :award_ids, :dra, :intervention, :guided_reading, :lexile, :accel_bot, :accel_top,
:interest_low, :interest_high
它在控制台中工作:
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/ruby-1.9.3-p484@mysite/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$
Nets Mac Pro:mysite emai$be rspec spec/models/search_spec.rb
/Users/emai/.rvm/gems/ruby-1.9.3-p484@mysite/gems/ruby-debug-ide-0.4.18/lib/ruby-debug-ide/command.rb:27:警告:已初始化常量DEF_选项
************
悬而未决的:
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:4
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:5
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:6
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:7
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:8
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:9
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:10
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:11
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:12
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:13
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:14
搜寻#
#尚未实施
#/规格/型号/搜索规格rb:15
以0.4977秒完成
12个示例,0个故障,12个挂起
Nets Mac Pro:mysite emai$
在您的示例中发生了什么
it should { respond_to(:theme_ids) }
应该是
it { should respond_to(:theme_ids) }
同样地更改所有示例<必须在传递给
it
方法的块内调用code>should。很高兴提供帮助。超时结束时请接受答案:)