ruby on rails - How to test serialize column? -


i have in model this:

class mymodel < activerecord::base  serialize :my_column, array end 

how test it?

today i'm testing this:

it "column serialize array"  subject.my_column.is_a?(array).must_equal true end 

i'm using gem "minitest-rails-shoulda"

is there way test this?

tanks

you can shoulda-matchers.

class mymodeltest < activesupport::testcase   should serialize(:my_column) end 

check out code comments, should pretty straightforward.

if on rails 5, watch out there an issue.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -