Module: RSpecExplain

Defined in:
lib/rspec_explain.rb,
lib/rspec_explain/version.rb

Constant Summary collapse

VERSION =
"0.0.3"

Instance Method Summary collapse

Instance Method Details

#explain(method, examples, shoulder = :should) ⇒ Object

, run=‘subject.%s(%s)’



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rspec_explain.rb', line 8

def explain method, examples, shoulder=:should  ##, run='subject.%s(%s)'

  examples = prepare examples

  context "##{method}" do
    examples.each do |input,output|
      specify "#{input} => #{output}" do
        ##eval(run % [method, input.inspect]).should == output
        subject.send(method, input).send(shoulder) == output   #should == output
      end
    end
  end

end

#explain_not(method, examples) ⇒ Object



23
24
25
# File 'lib/rspec_explain.rb', line 23

def explain_not method, examples
  explain method, examples, :should_not
end