Tunisia's constituent assembly late on Sunday adopted a new constitution, more than three years after the revolution which began the Arab Spring.