On 27 Apr 2009, at 19:08, Andrew Premdas wrote:

Thankyou Aslak much appreciated

Bear in mind that this trick will change the value of the constant FOR ALL REMAINING SCENARIOS - not just the current one.

If that bothers you, have a read of this thread:
http://www.nabble.com/AfterCurrentScenario-block-td23100686.html



Andrew

2009/4/27 aslak hellesoy <aslak.helle...@gmail.com>

Good question. One answer is that it can change, it just needs a code change and application restart.

Basic business case is that someone will set the postage threshold before the application is deployed. However they could choose any value. So I want to test what happens when the application is setup with different values e.g. zero because all postage is free and £30 cos postage is free if you spend £50 or more.

Currently we do not want to do form based admin for this setting (and similar ones) because such a change would be very infrequent, so we are currently happy to redeploy to make the change.

I would do something like this: http://gist.github.com/102586



2009/4/27 aslak hellesoy <aslak.helle...@gmail.com>



On Mon, Apr 27, 2009 at 2:00 PM, Andrew Premdas <aprem...@gmail.com> wrote: Currently I have a very simple constants implementation being loaded as a Rails initialiser

module MVOR
  module Postage
    THRESHOLD = BigDecimal.new('6.99')
    RATE = BigDecimal.new('30.00')
  end
end


My scenarios of my postage feature want to deal with two situations when the THRESHOLD has been set to zero and to '6.99'. The question is how can I set the threshold in my step_definition. So I want to implement

  Given the postage threshold is 0.00
  Given the postage threshold is 6.99


Since it's a constant - how can it possibly change? And therefore - why are you testing it with different values?


I've considered a number of ideas, but seem to keep on getting into complex solutions for what I assume is something very simple.

TIA


_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to