Top Level Namespace
Defined Under Namespace
Modules: Mspec
Constant Summary collapse
- COLOUR_CODES =
{ true => 32, false => 31 }
Instance Method Summary collapse
- #allow(obj) ⇒ Object
- #describe(str) ⇒ Object
- #eq(obj) ⇒ Object
- #expect(obj) ⇒ Object
- #it(str) ⇒ Object
- #receive(method, &block) ⇒ Object
- #test_double(name = 'anonymous') ⇒ Object
Instance Method Details
#allow(obj) ⇒ Object
5 6 7 |
# File 'lib/m-spec/mocks/helpers/readable.rb', line 5 def allow(obj) Mspec::Mocks::Allow.new(obj) end |
#describe(str) ⇒ Object
6 7 8 9 |
# File 'lib/m-spec/core/helpers/readable.rb', line 6 def describe(str) puts str yield end |
#eq(obj) ⇒ Object
27 28 29 |
# File 'lib/m-spec/core/helpers/readable.rb', line 27 def eq(obj) Mspec::Matchers::Equal.new(obj) end |
#expect(obj) ⇒ Object
23 24 25 |
# File 'lib/m-spec/core/helpers/readable.rb', line 23 def expect(obj) Mspec::Expect.new(obj) end |
#it(str) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/m-spec/core/helpers/readable.rb', line 11 def it(str) spec_result = yield colour_code = COLOUR_CODES[spec_result.success?] puts " \e[#{colour_code}m#{str}\e[0m" unless spec_result.success? spec_result.simple_stack_trace.each do |stackline| puts " \e[#{colour_code}m#{stackline}\e[0m" end end end |