[rspec-users] RSpec/rails & Capybara: #within

Justin Ko jko170 at gmail.com
Tue Jul 24 02:50:58 UTC 2012


On Jul 22, 2012, at 3:08 PM, Salvatore Pelligra wrote:

> I'm new with Capybara and after a good amount of google, I still can't
> figure out how the #within methods works!
> I can use it only if I call visit before? There's no way to use it on a
> string, like the `page = Capybara.string(html_string)` trick?
> 
> When describe a view, I want something like that:
> describe "path/to/view.html.erb" do
>  it "should pass" do
>    render
>    within('form#id') {
>      should have_selector 'input', type: 'submit'
>      should have_selector 'input', type: 'text', value: 'default'
>      # ...
>    }
>  end
> end
> 
> PS: Hope this is the right sections! ^^"
> 
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

Please post this to the Capybara group, thanks.

https://groups.google.com/forum/?fromgroups#!forum/ruby-capybara


More information about the rspec-users mailing list