`
sg552
  • 浏览: 613068 次
  • 性别: Icon_minigender_1
  • 来自: 北京
博客专栏
47437293-94b9-3b04-9152-8971c7580049
白手起家学习使用Flex
浏览量:18443
社区版块
存档分类
最新评论

ruby , rspec中测试 module

阅读更多
见:  http://stackoverflow.com/questions/1542945/testing-modules-in-rspec/1546493#1546493

What mike said. Here's a trivial example:

module code...
module Say
  def hello
    "hello"
  end
end


spec fragment...

class DummyClass
end

before(:each) do
  @dummy_class = DummyClass.new
  @dummy_class.extend(Say)
end

it "get hello string" do
  @dummy_class.hello.should == "hello"
end



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics