0
在测试模块我模块嵌套在一个模块中RSpec的 - 如何在模块
类似的东西:
module Utilities
extend ActiveSupport::Concern
module InstanceMethods
def fix_text(str, params = {})
str = Iconv.conv('UTF8', 'LATIN1', str)
str.gsub!(/\\u([0-9a-z]{4})/) { |s| [$1.to_i(16)].pack("U") }
str.force_encoding("UTF-8")
str = strip_html(str) unless params[:no_strip_html]
MojiBake::Mapper.new.recover str
end
def strip_html(str)
Hpricot(str, :xhtml => true).to_plain_text
end
end
end
我没有在互联网信息如何在模块测试模块中。
请为这个规范写一些伪代码(describe和module blocks的顺序,如何测试module是否扩展其他模块等)。
还有就是当你测试一个模块没有其它附加的约束。指示/残桩忽略了通常的规则。我无法理解你期待的答案 – apneadiving 2012-04-13 09:58:24
其实我是RSpec的新手。你可以写一些伪代码如何测试该模块? – 2012-04-13 10:17:03