Skip to content

Commit

Permalink
working program assumptions
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobAlexander committed Sep 28, 2016
1 parent d6395b6 commit a92e537
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions run.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
def describe(description, &block)
ExampleGroup.new(block).evaluate
end

class ExampleGroup

def initialize(block)
@block = block
end

def evaluate
# we are using instance_eval because otherwise we are working in describe method context, where program don't know about it method
# by usind self.instance eval, we are executing provided block code inside ExampleGroup class, that mean, program knows about it method
self.instance_eval(&@block)
end

def it(description, &block)
block.call
end

end


describe "Amazing RSpeclike example" do
it "works!" do
puts "hello"
Expand Down

0 comments on commit a92e537

Please sign in to comment.