I mentioned SitePrism yesterday and so I wanted to go in a little more depth. From my example yesterday, I used an inventory show page and an inventory index page. I had a find_inventory method on inventory index and a displayed? method on inventory show. I actually reconsidered the displayed? method and so I’m going to show how to use SitePrism to validate that the page has loaded in a different way.
Let’s look at the InventoriesIndex SitePrism page:
This makes my tests much each to read. Instead of typing
in my test, it instead looks like:
SO MUCH PRETTIER!
Let’s look at how SitePrism can help our InventoryShow page:
With just that little bit, we can validate that the page loaded what we want:
Overall, so much nicer than having all the css/xpath selectors all over your RSpec tests. Check it out!