Ruby on Rails Friday, July 14, 2017

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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
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.

No comments:

Post a Comment