0

I'm testing a method written in ruby on rails. The short story is - I'm using the Axlsx gem to create an Excel spreadsheet from ruby. I'd like to test (using Rake) that the add_row method is assigning the style I want to the row. The method returns an array where the first item is the text in each cell in the row, and the second item is the style info for each cell.

Now, Rake can tell that the first array element is correct, but it's returning nil for the second, meaning the style information isn't visible outside of my class.

Rather than try to wriggle through Axlsx's documentation and rules, I thought it'd be much simpler to verify the style is being assigned in the method and send a message back to Rake to verify this. Is there a way I can do this? Thank you!

Argus9
  • 1,863
  • 4
  • 26
  • 40
  • I am not clear about what you mean. If you store your data from a form, then verify you have it in the params hash, thrn to verify if the data is correctly passed to db, go to console and show the tables or use (rails style) sql query there – epsilones Aug 20 '13 at 22:45
  • Let's assume I'm just hard-coding the values being passed into `sheet.add_row`, like this: `sheet.add_row ["Foo", "Bar"], style: [black_bg, black_bg]`. Assume black_bg is just a style declared earlier. My issue is that when I check the `return`ed value (which is returned as a size-two array - the first element is an array containing the text, the second is an array containing the styles), the first array element returns text, but the second array element is `nil`. – Argus9 Aug 21 '13 at 14:19

0 Answers0