Hi,

I am working some test scripts with rspec, I try to pend example, once
user input is not supported. However, the result is not what I
expected pending example, instead of exception - "NameError: undefined
local variable or method `example'"

I know pending method works inside of describe block, but my question
is how pending method work outside of rspec example, just like should
method?

Thanks.

source code is enclosed.
## harness.rb
require "rspec"
class Harness
  include RSpec::Core::Pending

  def get_fruit(fruit_name)
    pending "your input #{fruit_name} does not supported yet!" unless
get_supported_fruits().include?(fruit_name)
    create(fruit_name)
  end
end

# fruit_spec.rb
require "harness"
describe "create fruit" do
  it "create pineapple" do
    harness = Harness.new
    fruit = harness.get_fruit("pineapple")
  end
end

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rspec?hl=en.

Reply via email to