hoangdangninh
6/22/2017 - 7:22 PM

From 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