Jeff Jeff - 11 days ago 4
Ruby Question

How do you compare multiple RHS values in RSPec?

I'm new to RSpec, and I'm trying to run "should == A || B", but it's ignoring the 'B' and is only comparing with 'A' (and thus failing when val is 'B'):

Sample.find(:all).map(&:param).each{|val| val.should == 'A'||'B'}

Does anyone know how I include the 'B' in the comparison?

['A', 'B'].should include(val)

That might get your spec passing, but is it what you want to test? That the return value is a member of a set? If so, then perhaps this is a good solution.