Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Unverified Commit a54cdfc2 authored by Zamith's avatar Zamith
Browse files

[Specs] Adds convenience method context

Context does the same as describe, but is more semantic on some contexts
(no pun intended).
parent 94eaa43d
No related merge requests found
...@@ -40,4 +40,10 @@ describe "Spec matchers" do ...@@ -40,4 +40,10 @@ describe "Spec matchers" do
42.should_not be_falsey 42.should_not be_falsey
end end
end end
context "should work as describe" do
it "is true" do
true.should be_truthy
end
end
end end
...@@ -82,6 +82,10 @@ def describe(description, file = __FILE__, line = __LINE__) ...@@ -82,6 +82,10 @@ def describe(description, file = __FILE__, line = __LINE__)
end end
end end
def context(description, file = __FILE__, line = __LINE__, &block)
describe(description.to_s, file, line, &block)
end
def it(description, file = __FILE__, line = __LINE__) def it(description, file = __FILE__, line = __LINE__)
return if Spec.aborted? return if Spec.aborted?
return unless Spec.matches?(description, file, line) return unless Spec.matches?(description, file, line)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment