I am writing integration tests using Rspec and Capybara. I noticed that quite often I have to execute the same code snippets when it comes to testing the creation of activerecord parameters.
For instance:
it "should create a new instance" do
end
it "should do something based on a new instance" do
end
The problem is that ActiveRecord objects are not saved in tests, however Capybara by default supports the same session in the specification (weirdness).
I could mock these entries, but since this is an integration test, and some of these entries are quite complex (they have image attachments and much more), it’s much easier to use Capybara and fill out forms that appeal to the user.
, , - . ?