Outline

When before syntax is called in Rspec. ?

Example

describe "before spec example" do

  before(:all) do
    # do somthing all(1)
  end

  before(:each) do
    # do somthing each(1)
  end

  it "" doa
    # execute : before all(1)
    # execute : before each(1)
  end

  context "" do

    before(:all) do
      # do somthing all(2)
    end

    before(:each) do
      # do somthing each(2)
    end

    it "" do
      # execute : before all(2)
      # execute : before each(1)
      # execute : before each(2)
    end
    context "" do
      it "" do
        # execute : before each(1)
        # execute : before each(2)
      end
    end

  end

end