Is it possible to have mobile and desktop system specs?

11 views
Skip to first unread message

Marko Avlijas

unread,
Mar 8, 2022, 4:43:38 PM3/8/22
to rspec
Hi,

I am working on an application which uses different partials for mobile and desktop version. Both are served in every request. I need to test turbo code that replaces all of these partials. Mobile version even has different workflow compared to desktop app in some parts.

In short I want to have separate system tests for mobile and desktop version.

I thought I could achieve that by having different driven by in before block.

driven_by(:cuprite, screen_size: [1400, 1400], options: CUPRITE_OPTIONS)
driven_by(:cuprite, screen_size: [400, 800], options: CUPRITE_OPTIONS)

Unfortunately these settings are not respected. It seems that first system spec that sets driven_by is what rspec uses for entire test suite.

Is it possible to achieve separate system specs for mobile and desktop version and how?

Thank you,

Marko


Jon Rowe

unread,
Mar 9, 2022, 5:31:03 AM3/9/22
to rs...@googlegroups.com
Hi Marko

The `driven_by` functionality comes straight from Rails, it seems this issue is essentially what you are experiencing:


And the TL;DR solution is to add `name:` to the options, e.g. `name: 'cuprite_mobile', screen_size: ...`

Cheers
Jon
--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.

Marko Avlijas

unread,
Mar 9, 2022, 9:57:11 AM3/9/22
to rs...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages