New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate `assert_template` and `assigns()`. #20138

Merged
merged 1 commit into from Jun 1, 2015

Conversation

Projects
None yet
5 participants
@tgxworld
Contributor

tgxworld commented May 13, 2015

Related: #18950.

cc/ @dhh

@@ -315,8 +315,6 @@ def test_opens_new_session
session1 = @test.open_session { |sess| }
session2 = @test.open_session # implicit session
assert_respond_to session1, :assert_template, "open_session makes assert_template available"
assert_respond_to session2, :assert_template, "open_session makes assert_template available"

This comment has been minimized.

@dhh

dhh May 13, 2015

Member

Would be nice to have both assert_template and assigns() available in a
plugin, so people who like that kind of thing can continue using it.

On Wed, May 13, 2015 at 12:38 PM, Guo Xiang Tan notifications@github.com
wrote:

In actionpack/test/controller/integration_test.rb
#20138 (comment):

@@ -315,8 +315,6 @@ def test_opens_new_session
session1 = @test.open_session { |sess| }
session2 = @test.open_session # implicit session

  • assert_respond_to session1, :assert_template, "open_session makes assert_template available"
  • assert_respond_to session2, :assert_template, "open_session makes assert_template available"

Duplicated in
https://github.com/tgxworld/rails/blob/deprecated_assert_template/actionpack/test/dispatch/template_assertions_test.rb#L66


Reply to this email directly or view it on GitHub
https://github.com/rails/rails/pull/20138/files#r30219276.

@dhh

dhh May 13, 2015

Member

Would be nice to have both assert_template and assigns() available in a
plugin, so people who like that kind of thing can continue using it.

On Wed, May 13, 2015 at 12:38 PM, Guo Xiang Tan notifications@github.com
wrote:

In actionpack/test/controller/integration_test.rb
#20138 (comment):

@@ -315,8 +315,6 @@ def test_opens_new_session
session1 = @test.open_session { |sess| }
session2 = @test.open_session # implicit session

  • assert_respond_to session1, :assert_template, "open_session makes assert_template available"
  • assert_respond_to session2, :assert_template, "open_session makes assert_template available"

Duplicated in
https://github.com/tgxworld/rails/blob/deprecated_assert_template/actionpack/test/dispatch/template_assertions_test.rb#L66


Reply to this email directly or view it on GitHub
https://github.com/rails/rails/pull/20138/files#r30219276.

This comment has been minimized.

@tgxworld

tgxworld May 13, 2015

Contributor

Publish the plugin as a gem?

@tgxworld

tgxworld May 13, 2015

Contributor

Publish the plugin as a gem?

This comment has been minimized.

@dhh

dhh May 13, 2015

Member

Yes, a separate gem that we can point the deprecations to.

On Wed, May 13, 2015 at 4:57 PM, Guo Xiang Tan notifications@github.com
wrote:

In actionpack/test/controller/integration_test.rb
#20138 (comment):

@@ -315,8 +315,6 @@ def test_opens_new_session
session1 = @test.open_session { |sess| }
session2 = @test.open_session # implicit session

  • assert_respond_to session1, :assert_template, "open_session makes assert_template available"
  • assert_respond_to session2, :assert_template, "open_session makes assert_template available"

Publish the plugin as a gem? Date: Wed, 13 May 2015 07:14:31 -0700 From:
notifications@github.com To: rails@noreply.github.com CC:
tgx_world@hotmail.com Subject: Re: [rails] Deprecate assert_template. (
#20138 #20138) In
actionpack/test/controller/integration_test.rb:
@@ -315,8 +315,6 @@ def test_opens_new_session session1 =
@test.open_session { |sess| } session2 = @test.open_session # implicit
session - assert_respond_to session1, :assert_template, "open_session makes
assert_template available" - assert_respond_to session2, :assert_template,
"open_session makes assert_template available"
Would be nice to have both assert_template and assigns() available in a
plugin, so people who like that kind of thing can continue using it. … On
Wed, May 13, 2015 at 12:38 PM, Guo Xiang Tan notifications@github.com
wrote: In actionpack/test/controller/integration_test.rb <
https://github.com/rails/rails/pull/20138#discussion_r30219276>: @@
-315,8 +315,6 @@ def test_opens_new_session session1 = @test.open_session {
|sess| } session2 = @test.open_session # implicit session -
assert_respond_to session1, :assert_template, "open_session makes
assert_template available" - assert_respond_to session2, :assert_template,
"open_session makes assert_template available" Duplicated in
https://github.com/tgxworld/rails/blob/deprecated_assert_template/actionpack/test/dispatch/template_assertions_test.rb#L66
― Reply to this email directly or view it on GitHub <
https://github.com/rails/rails/pull/20138/files#r30219276>. ― Reply to
this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
https://github.com/rails/rails/pull/20138/files#r30238792.

@dhh

dhh May 13, 2015

Member

Yes, a separate gem that we can point the deprecations to.

On Wed, May 13, 2015 at 4:57 PM, Guo Xiang Tan notifications@github.com
wrote:

In actionpack/test/controller/integration_test.rb
#20138 (comment):

@@ -315,8 +315,6 @@ def test_opens_new_session
session1 = @test.open_session { |sess| }
session2 = @test.open_session # implicit session

  • assert_respond_to session1, :assert_template, "open_session makes assert_template available"
  • assert_respond_to session2, :assert_template, "open_session makes assert_template available"

Publish the plugin as a gem? Date: Wed, 13 May 2015 07:14:31 -0700 From:
notifications@github.com To: rails@noreply.github.com CC:
tgx_world@hotmail.com Subject: Re: [rails] Deprecate assert_template. (
#20138 #20138) In
actionpack/test/controller/integration_test.rb:
@@ -315,8 +315,6 @@ def test_opens_new_session session1 =
@test.open_session { |sess| } session2 = @test.open_session # implicit
session - assert_respond_to session1, :assert_template, "open_session makes
assert_template available" - assert_respond_to session2, :assert_template,
"open_session makes assert_template available"
Would be nice to have both assert_template and assigns() available in a
plugin, so people who like that kind of thing can continue using it. … On
Wed, May 13, 2015 at 12:38 PM, Guo Xiang Tan notifications@github.com
wrote: In actionpack/test/controller/integration_test.rb <
https://github.com/rails/rails/pull/20138#discussion_r30219276>: @@
-315,8 +315,6 @@ def test_opens_new_session session1 = @test.open_session {
|sess| } session2 = @test.open_session # implicit session -
assert_respond_to session1, :assert_template, "open_session makes
assert_template available" - assert_respond_to session2, :assert_template,
"open_session makes assert_template available" Duplicated in
https://github.com/tgxworld/rails/blob/deprecated_assert_template/actionpack/test/dispatch/template_assertions_test.rb#L66
― Reply to this email directly or view it on GitHub <
https://github.com/rails/rails/pull/20138/files#r30219276>. ― Reply to
this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
https://github.com/rails/rails/pull/20138/files#r30238792.

This comment has been minimized.

@tgxworld

tgxworld May 13, 2015

Contributor

Sure I'll look into it.

@tgxworld

tgxworld May 13, 2015

Contributor

Sure I'll look into it.

@@ -580,11 +579,11 @@ To test AJAX requests, you can specify the `xhr: true` option to `get`, `post`,
`patch`, `put`, and `delete` methods:
```ruby
test "ajax request responds with no layout" do

This comment has been minimized.

@simi

simi May 13, 2015

Contributor

I think this name is still valid for this test.

@simi

simi May 13, 2015

Contributor

I think this name is still valid for this test.

This comment has been minimized.

@tgxworld

tgxworld May 13, 2015

Contributor

It doesn't render a layout but I think we shouldn't be encouraging others to test for it.

@tgxworld

tgxworld May 13, 2015

Contributor

It doesn't render a layout but I think we shouldn't be encouraging others to test for it.

@tgxworld tgxworld changed the title from Deprecate `assert_template`. to Deprecate `assert_template` and `assigns()`. May 23, 2015

@tgxworld

This comment has been minimized.

Show comment
Hide comment
@tgxworld

tgxworld May 23, 2015

Contributor

@dhh @matthewd I've deprecated both assigns() and assert_template and extraced both methods into a plugin. I'll still have to publish the gem though.

Contributor

tgxworld commented May 23, 2015

@dhh @matthewd I've deprecated both assigns() and assert_template and extraced both methods into a plugin. I'll still have to publish the gem though.

@tgxworld

This comment has been minimized.

Show comment
Hide comment
Contributor

tgxworld commented May 23, 2015

Show outdated Hide outdated actionpack/lib/action_controller/template_assertions.rb
@@ -102,6 +102,11 @@ def reset_template_assertion
# # assert that the "_customer" partial was rendered with a specific object
# assert_template partial: '_customer', locals: { customer: @customer }
def assert_template(options = {}, message = nil)
ActiveSupport::Deprecation.warn(

This comment has been minimized.

@rafaelfranca

rafaelfranca May 28, 2015

Member

We should raise a NoMethodError and point to the gem so we can remove all the implementation

@rafaelfranca

rafaelfranca May 28, 2015

Member

We should raise a NoMethodError and point to the gem so we can remove all the implementation

This comment has been minimized.

@tgxworld

tgxworld May 29, 2015

Contributor

I thought we had to deprecate it first?

@tgxworld

tgxworld May 29, 2015

Contributor

I thought we had to deprecate it first?

This comment has been minimized.

@rafaelfranca

rafaelfranca May 29, 2015

Member

If we are extracting a gem there is no need. The NoMethodError message should tell about the gem and people can get it work adding the gem to their Gemfile.

@rafaelfranca

rafaelfranca May 29, 2015

Member

If we are extracting a gem there is no need. The NoMethodError message should tell about the gem and people can get it work adding the gem to their Gemfile.

This comment has been minimized.

@tgxworld

tgxworld May 29, 2015

Contributor

Do you want me to transfer the Gem to Rails? Although Rails isn't supporting these two methods, it seems weird that we're pointing to my personal repository.

@tgxworld

tgxworld May 29, 2015

Contributor

Do you want me to transfer the Gem to Rails? Although Rails isn't supporting these two methods, it seems weird that we're pointing to my personal repository.

This comment has been minimized.

@rafaelfranca

rafaelfranca May 29, 2015

Member

👍 transfer to Rails so I can give you commit access.

@rafaelfranca

rafaelfranca May 29, 2015

Member

👍 transfer to Rails so I can give you commit access.

This comment has been minimized.

@tgxworld

tgxworld May 29, 2015

Contributor

Hmm I can't transfer without admin rights. Better to fork in this case?

@tgxworld

tgxworld May 29, 2015

Contributor

Hmm I can't transfer without admin rights. Better to fork in this case?

This comment has been minimized.

@rafaelfranca

rafaelfranca May 29, 2015

Member

transfer to me so I can transfer to Rails.

@rafaelfranca

rafaelfranca May 29, 2015

Member

transfer to me so I can transfer to Rails.

This comment has been minimized.

@tgxworld

tgxworld May 29, 2015

Contributor

Thanks! I'll remove the method soon.

@tgxworld

tgxworld May 29, 2015

Contributor

Thanks! I'll remove the method soon.

This comment has been minimized.

@rafaelfranca

rafaelfranca May 29, 2015

Member

Don't remove the methods, just change their implementation to:

def assert_template(*)
  raise NoMethodError, "assert_template was extracted to a gem. To continue using it use the ..."
end
@rafaelfranca

rafaelfranca May 29, 2015

Member

Don't remove the methods, just change their implementation to:

def assert_template(*)
  raise NoMethodError, "assert_template was extracted to a gem. To continue using it use the ..."
end

This comment has been minimized.

@tgxworld

tgxworld May 29, 2015

Contributor

Ok I'll remove the internal tests in this case.

@tgxworld

tgxworld May 29, 2015

Contributor

Ok I'll remove the internal tests in this case.

Show outdated Hide outdated actionpack/lib/action_dispatch/testing/test_process.rb
@@ -5,6 +5,12 @@
module ActionDispatch
module TestProcess
def assigns(key = nil)
ActiveSupport::Deprecation.warn(

This comment has been minimized.

@rafaelfranca

rafaelfranca May 28, 2015

Member

same about NoMethodError

@rafaelfranca

rafaelfranca May 28, 2015

Member

same about NoMethodError

@tgxworld

This comment has been minimized.

Show comment
Hide comment
@tgxworld

tgxworld May 30, 2015

Contributor

Updated but there is some problem on Travis that isn't related.

Contributor

tgxworld commented May 30, 2015

Updated but there is some problem on Travis that isn't related.

@rafaelfranca rafaelfranca added this to the 5.0.0 milestone May 30, 2015

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca May 30, 2015

Member

Great work! Could you add a CHANGELOG entry?

Member

rafaelfranca commented May 30, 2015

Great work! Could you add a CHANGELOG entry?

@tgxworld

This comment has been minimized.

Show comment
Hide comment
@tgxworld

tgxworld May 30, 2015

Contributor

Great work! Could you add a CHANGELOG entry?

O yeah forgot about it XD. Done 😄

Contributor

tgxworld commented May 30, 2015

Great work! Could you add a CHANGELOG entry?

O yeah forgot about it XD. Done 😄

Show outdated Hide outdated actionpack/CHANGELOG.md
@@ -1,3 +1,9 @@
* Deprecate `assigns` and `assert_template`.

This comment has been minimized.

@rafaelfranca

rafaelfranca May 30, 2015

Member

I think it is better to tell that these methods were extracted to the gem and point to it on the changelog.

@rafaelfranca

rafaelfranca May 30, 2015

Member

I think it is better to tell that these methods were extracted to the gem and point to it on the changelog.

@@ -1,3 +1,10 @@
* Remove `assigns` and `assert_template`. Both methods have been extracted
into a gem at https://github.com/rails/rails-controller-testing.

This comment has been minimized.

@tgxworld

tgxworld May 30, 2015

Contributor

@rafaelfranca Is this ok? 😄

@tgxworld

tgxworld May 30, 2015

Contributor

@rafaelfranca Is this ok? 😄

rafaelfranca added a commit that referenced this pull request Jun 1, 2015

Merge pull request #20138 from tgxworld/deprecated_assert_template
Deprecate `assert_template` and `assigns()`.

@rafaelfranca rafaelfranca merged commit bdfc662 into rails:master Jun 1, 2015

@kirs

This comment has been minimized.

Show comment
Hide comment
@kirs

kirs Jun 6, 2015

Member

👍 great job!

Member

kirs commented Jun 6, 2015

👍 great job!

@rafaelfranca rafaelfranca modified the milestones: 5.0.0 [temp], 5.0.0 Dec 30, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment