[rspec-users] Does rspec support something like Assumptions in JUnit 4.4?

Zach Dennis zach.dennis at gmail.com
Mon Jun 1 09:16:23 EDT 2009


On Mon, Jun 1, 2009 at 7:26 AM, mortench <mortench at gmail.com> wrote:
> Correction for last msg:
>
> before(:all) do
>    @org_root_prop = java.lang.System.getProperty("root")
>
>    # abort all examples and after action if condition is not meet:
>    ensure_that !@org_root_prop.nil? && @org_root_prop.strip.length>0
> end

You could do this check outside of the example? ie:

describe "...." do
   def self.ensure_that(condition, &blk)
      yield if condition
   end

   def self.root_property_is_not_blank
     org_root_prop = java.lang.System.getProperty("root")
     org_root_prop.nil? && org_root_prop.strip.length>0
   end

   ensure_that root_property_is_not_blank do
      it "...." do
      end
  end
end

>
> /Morten
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>



-- 
Zach Dennis
http://www.continuousthinking.com (personal)
http://www.mutuallyhuman.com (hire me)
http://ideafoundry.info/behavior-driven-development (first rate BDD training)
@zachdennis (twitter)


More information about the rspec-users mailing list