I have a method that returns a random value from a predefined array (namely: [ 'value1', 'value2'] ). How to check this with rspec?
[ 'value1', 'value2']
I would like to do something like:
expect(FooClass.new.value).to be_in ['value1', 'value2']
How to do it? Thanks.
Use this
expect(['value1', 'value2']).to include(FooClass.new.value)
Or a simple logical match
expect(['value1', 'value2'].include? FooClass.new.value).to be true
Source: https://habr.com/ru/post/1205665/More articles:Application crash on startup - iosRust: Segfault when executing a specific line of code from a dynamically loaded library - segmentation-faultXcode 6 - Universal Storyboard Projects Will Support iOS 7? - iosUser Circular Review - androidHow to run SFML in CLion, Error undefined reference to? - c ++return byte array in jni android? - androidDelay when activating a text field inside the iOS 8 user keyboard - ioshttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1205668/access-to-variables-from-outside-function&usg=ALkJrhie8Y91CuRYj3jkWyTfG1o70aWuYwMySQL String Returns Based on Additional PDO Parameters - arraysNested PrimeFaces form inside p: dialog with appendTo = "@ (body) - nested-formsAll Articles