Rspec. assert_select deprecated?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Rspec. assert_select deprecated?

Ralph Shnelvar
In https://apidock.com/rails/ActionController/Assertions/SelectorAssertions/assert_select I see that  assert_select was deprecated.

Yes, when I run
rails generate scaffold SqlStatement \
  title
:text{120} \
  description
:text \
  sql_stmt
:text

I find the following code generated in ~/spec/views/sql_statements/index.html.erb_spec.rb
require 'rails_helper'

RSpec.describe "sql_statements/index", type: :view do
  before
(:each) do
    assign
(:sql_statements, [
     
SqlStatement.create!(
       
:title => "MyText",
       
:description => "MyText",
       
:sql_stmt => "MyText"
     
),
     
SqlStatement.create!(
       
:title => "MyText",
       
:description => "MyText",
       
:sql_stmt => "MyText"
     
)
   
])
 
end

  it
"renders a list of sql_statements" do
    render
    byebug
    assert_select
"tr>td", :text => "MyText".to_s, :count => 2
    assert_select
"tr>td", :text => "MyText".to_s, :count => 2
    assert_select
"tr>td", :text => "MyText".to_s, :count => 2
 
end
end
So is it deprecated?  What's it replaced by?  Where can I find documentation? 


I find
no mention of assert_select in http://rspec.info/documentation/3.6/rspec-rails/

I find assert_select
defined in ~/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rails-dom-testing-2.0.3/lib/rails/dom/testing/assertions/selector_assertions.rb .

What am I not understanding?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/194852e0-d775-4149-8282-1c65e56a8575%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rspec. assert_select deprecated?

Frederick Cheung-2

On Friday, July 14, 2017 at 9:58:56 AM UTC+1, Ralph Shnelvar wrote:
So is it deprecated?  What's it replaced by?  Where can I find documentation? 


apidock things things are deprecated when they move - it doesn't know it was extracted into the rails-dom-testing gem 


I find
no mention of assert_select in http://<a href="http://rspec.info/documentation/3.6/rspec-rails/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frspec.info%2Fdocumentation%2F3.6%2Frspec-rails%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEKhJ5CtkzWJt6lR1pwHSyIQzDHbA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frspec.info%2Fdocumentation%2F3.6%2Frspec-rails%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEKhJ5CtkzWJt6lR1pwHSyIQzDHbA&#39;;return true;">rspec.info/documentation/3.6/rspec-rails/


The rails specific assertions aren't part of rspec-rails (you can still use them because rspec-rails wraps the rails testing facilities). ALthough rspec doesn't really care what assertion library you use, I've more commonly seen people use the capybara rspec matches in such cases (expect(rendered).to have_css('tr>td', count: 2, ...)

Fred
 
I find assert_select defined in ~/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rails-dom-testing-2.0.3/lib/rails/dom/testing/assertions/selector_assertions.rb .

What am I not understanding?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0866b6c7-f28d-4cca-a273-53ba8f97d84d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rspec. assert_select deprecated?

Ralph Shnelvar
So ... where can I find current documentation on assert_select?

Is assert_select an Rspec facility or a wrapper around some other facility I need to learn?

If it isn't apparent, Fred, thank you.

Ralph



On Friday, July 14, 2017 at 5:15:04 AM UTC-6, Frederick Cheung wrote:

On Friday, July 14, 2017 at 9:58:56 AM UTC+1, Ralph Shnelvar wrote:
So is it deprecated?  What's it replaced by?  Where can I find documentation? 


apidock things things are deprecated when they move - it doesn't know it was extracted into the rails-dom-testing gem 


I find
no mention of assert_select in http://<a href="http://rspec.info/documentation/3.6/rspec-rails/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frspec.info%2Fdocumentation%2F3.6%2Frspec-rails%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEKhJ5CtkzWJt6lR1pwHSyIQzDHbA&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frspec.info%2Fdocumentation%2F3.6%2Frspec-rails%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEKhJ5CtkzWJt6lR1pwHSyIQzDHbA&#39;;return true;">rspec.info/documentation/3.6/rspec-rails/


The rails specific assertions aren't part of rspec-rails (you can still use them because rspec-rails wraps the rails testing facilities). ALthough rspec doesn't really care what assertion library you use, I've more commonly seen people use the capybara rspec matches in such cases (expect(rendered).to have_css('tr>td', count: 2, ...)

Fred
 
I find assert_select defined in ~/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rails-dom-testing-2.0.3/lib/rails/dom/testing/assertions/selector_assertions.rb .

What am I not understanding?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/968b99c3-ea53-46c3-a000-d7e5c4af1179%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Rspec. assert_select deprecated?

Frederick Cheung-2
On Friday, July 14, 2017 at 2:49:48 PM UTC+1, Ralph Shnelvar wrote:
> So ... where can I find current documentation on assert_select?
>
> Is assert_select an Rspec facility or a wrapper around some other facility I need to learn?
>

It was extracted from rails into the rails-dom-testing gem, so I would start with  https://github.com/rails/rails-dom-testing/blob/master/README.md

Fred

> If it isn't apparent, Fred, thank you.
>
> Ralph
>
>
>
> On Friday, July 14, 2017 at 5:15:04 AM UTC-6, Frederick Cheung wrote:
>
> On Friday, July 14, 2017 at 9:58:56 AM UTC+1, Ralph Shnelvar wrote:
> So is it deprecated?  What's it replaced by?  Where can I find documentation? 
>
>
>
>
> apidock things things are deprecated when they move - it doesn't know it was extracted into the rails-dom-testing gem 
>
>
>
>
> I find no mention of assert_select in http://rspec.info/documentation/3.6/rspec-rails/
>
>
>
>
> The rails specific assertions aren't part of rspec-rails (you can still use them because rspec-rails wraps the rails testing facilities). ALthough rspec doesn't really care what assertion library you use, I've more commonly seen people use the capybara rspec matches in such cases (expect(rendered).to have_css('tr>td', count: 2, ...)
>
>
> Fred
>  
>
> I find assert_select defined in ~/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rails-dom-testing-2.0.3/lib/rails/dom/testing/assertions/selector_assertions.rb .
>
> What am I not understanding?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3334eacc-6b95-4b8c-97c0-1094f1c04844%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...