是否可以定义跨越多个测试的Capybara范围(在RSpec中)?
例如,我想转此:
it 'has two things' do
within('.some-div') do
expect(page).to have_text('foo')
expect(page).to have_text('bar')
end
end
进入这个:
context 'with two things' do
before :each do
within('.some-div') # pseudo-code - this doesn't work
end
it 'has foo' do
expect(page).to have_text('foo')
end
it 'has bar' do
expect(page).to have_text('bar')
end
end
我尝试使用这样的around
块:
around :each do |example|
within('.some-div') do
example.run
end
end
在解析并运行时,它实际上并未将within
范围应用于示例。
答案 0 :(得分:0)
你应该能够做到
public class WhileLoop {
public static void main(String[] args) {
double number= 25.2;
int myInt= 0;
int x=365;
while (myInt<9){ // Finite while loop
System.out.println("Hello "+ myInt);
myInt= myInt+1;
Thread.sleep(500l);
}
while(x>0){ //this is running out of year days loop
System.out.println(x);
x=x-1;
Thread.sleep(500l);
System.out.println(x);
}
while (number==25.2){ // an infinite loop
System.out.println("hahaha");
}
}
}