significance of modularity score or communities

I am new to igraph and R coding. I applied spinglass community detection to a directed network with 28 nodes and 214 edges, no weights. Database is a matrix. I found 2 communities with a modularity score = 0.32. I would like to find the significance of the modularity and/or the communities I found. I studied that I could do permutation test comparing my real network to random graphs. For example:Assess the significance of modularity (community structure)
Can someone please provide a me a code do it? I really do not know how to start