本文共 385 字,大约阅读时间需要 1 分钟。
见: [url]http://stackoverflow.com/questions/1542945/testing-modules-in-rspec/1546493#1546493[/url] What mike said. Here's a trivial example: module code...module Say def hello "hello" end endspec 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
转载地址:http://nwuci.baihongyu.com/