I have some model with the following validation:
validates_inclusion_of :value,
:in => I18n.available_locales.map(&:to_s)
I would think that I would be able to stub out that method in a test
like so:
it "should accepted any available locale as a value" do
I18n.stub!(:available_locales).and_return(['abc'])
my_model = MyModel.new( :value => 'abc' )
my_model.should have(:no).errors_on(:value)
end
But it keeps failing. It looks like the I18n inside the model is not
being stubbed correctly?!?! What am I doing wrong?
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users