In Rails app, I am Writing Rspec Test cases.
I have a controller file, which has a method called 'index' and this returns some values to the views file which is used as a header value to some table in that particular views file. The code example is as follows.
def index
@some_variable = [I18n.t('controllerFileName.index.someTitle1'),
I18n.t('controllerFileName.index.someTitle2')]
end
The sometitle1 and sometitle2 is going as an header to a view file.
I wanted to write a test case in controller to test whether the controller returns the correct expected value to the views file.(i.e. Sometitle1 and sometitle2 ) using Rspec.
I know that we can check the headers presence in views file using Rspec Test case. Just curious to know whether we can check the return values in controller file using Rspec.
I am new to Rspec. If it is not possible or there's a way to do this, please let me know.