Guest User

Untitled

a guest
Dec 11th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. require 'spec_helper'
  2.  
  3. $count = 0
  4. $count_each = 0
  5. $count_all = 0
  6.  
  7. shared_examples_for "before :each" do
  8. it { should == 1 }
  9. it { should == 2 }
  10. end
  11.  
  12. describe "before" do
  13. before do
  14. $count += 1
  15. end
  16.  
  17. subject { $count }
  18. it_should_behave_like "before :each"
  19. end
  20.  
  21. describe "before :each" do
  22. before :each do
  23. $count_each += 1
  24. end
  25.  
  26. subject { $count_each }
  27. it_should_behave_like "before :each"
  28. end
  29.  
  30. describe "before :all" do
  31. before :all do
  32. $count_all += 1
  33. end
  34.  
  35. subject { $count_all }
  36. it { should == 1 }
  37. it { should == 1 }
  38. end
Add Comment
Please, Sign In to add comment