ruby 来自http://lmws.net/describe-vs-context-in-rspec

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby 来自http://lmws.net/describe-vs-context-in-rspec相关的知识,希望对你有一定的参考价值。

describe "launch the rocket" do
  before(:each) do
    #prepare a rocket for all of the tests
    @rocket = Rocket.new
  end
 
  context "all ready" do
    before(:each) do
      #under the state of ready
      @rocket.ready = true
    end
 
    it "launch the rocket" do
      @rocket.launch().should be_true
    end
  end
 
  context "not ready" do
    before(:each) do
      #under the state of NOT ready
      @rocket.ready = false
    end
 
    it "does not launch the rocket" do
      @rocket.launch().should be_false
    end
  end
end

以上是关于ruby 来自http://lmws.net/describe-vs-context-in-rspec的主要内容,如果未能解决你的问题,请参考以下文章