Class: PidginSpec
- Inherits:
-
Object
- Object
- PidginSpec
- Defined in:
- lib/pidgin_spec.rb
Instance Attribute Summary collapse
-
#fail_count ⇒ Object
Returns the value of attribute fail_count.
-
#failure_messages ⇒ Object
Returns the value of attribute failure_messages.
-
#pass_count ⇒ Object
Returns the value of attribute pass_count.
-
#passed ⇒ Object
Returns the value of attribute passed.
-
#spec_count ⇒ Object
Returns the value of attribute spec_count.
Class Method Summary collapse
Instance Method Summary collapse
- #describe(des_statement, &block) ⇒ Object
-
#initialize(&block) ⇒ PidginSpec
constructor
A new instance of PidginSpec.
Constructor Details
#initialize(&block) ⇒ PidginSpec
Returns a new instance of PidginSpec.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/pidgin_spec.rb', line 8 def initialize(&block) @pass_count = 0 @fail_count = 0 @spec_count = 0 = [] instance_eval(&block) puts "\n#{@spec_count} tests run, #{@fail_count} fail#{"\n\nFailures:\n" if fail_count.nonzero?}".send(@fail_count.zero? ? 'green' : 'red') .each_with_index {|m, index| puts "#{index + 1}. #{m[:description]}\n#{"Wetin make am fail".red}: #{format(m[:failed_code])} \n #{m[:message].red}\n#{m[:failed_code_path].magenta}\n\n" } end |
Instance Attribute Details
#fail_count ⇒ Object
Returns the value of attribute fail_count.
7 8 9 |
# File 'lib/pidgin_spec.rb', line 7 def fail_count @fail_count end |
#failure_messages ⇒ Object
Returns the value of attribute failure_messages.
7 8 9 |
# File 'lib/pidgin_spec.rb', line 7 def end |
#pass_count ⇒ Object
Returns the value of attribute pass_count.
7 8 9 |
# File 'lib/pidgin_spec.rb', line 7 def pass_count @pass_count end |
#passed ⇒ Object
Returns the value of attribute passed.
7 8 9 |
# File 'lib/pidgin_spec.rb', line 7 def passed @passed end |
#spec_count ⇒ Object
Returns the value of attribute spec_count.
7 8 9 |
# File 'lib/pidgin_spec.rb', line 7 def spec_count @spec_count end |
Class Method Details
.describe(desc = nil, &block) ⇒ Object
2 3 4 5 |
# File 'lib/pidgin_spec.rb', line 2 def self.describe(desc = nil, &block) puts desc new(&block) end |
Instance Method Details
#describe(des_statement, &block) ⇒ Object
20 21 22 |
# File 'lib/pidgin_spec.rb', line 20 def describe(des_statement, &block) ExampleGroup.new(des_statement, self, &block) end |