0

I'm currently working on fixing up some specs, and have found a piece of syntax that nobody seems to know what represents.

In the Capybara Suite there are multiple occurrences of:

within(:css, '#foo') do

By removing the :css I have found this to be functionally identical to within('#foo') do

Is there a difference? What other symbols can be passed in as a first parameter to within?

Andrei Botalov
  • 20,686
  • 11
  • 89
  • 123
Abraham P
  • 15,029
  • 13
  • 58
  • 126

2 Answers2

0

After following @Andrey Botalov's link, I have found that this explains which kind of selector is being input into the within block.

In my case, Capybara.default_selector was set to :css, so :css was default. The only other option listed is :xpath

Abraham P
  • 15,029
  • 13
  • 58
  • 126
0

I think this is just repetitive code...unless theyre looking within acss for some text. But the better way to do thatwould be to say element.should.include? ('Text') and then set element equal tosome page.find (.css). But if youre asking what a within block does, it just scopes the test down. Ex: within ('.facebooklogin') do element.click End

Whitney Imura
  • 810
  • 1
  • 6
  • 15