Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Provides Rails 5 compatible testing methods for gradual migration from Rails 4 to 5.

License

NotificationsYou must be signed in to change notification settings

r7kamura/rails_kwargs_testing

Repository files navigation

GemBuild Status

Provides Rails 5 compatible testing methods for gradual migration from Rails 4 to 5.

Installation

Add this line to your application's Gemfile:

gem"rails_kwargs_testing"

And then execute:

bundle

Or install it yourself as:

geminstallrails_kwargs_testing

For controller tests

Prepend RailsKwargsTesting::ControllerMethods. Supported options are:

  • :flash
  • :format
  • :params
  • :session
  • :xhr
  • :as

Minitest

classArticlesControllerTest < ::ActionController::TestCaseprepend ::RailsKwargsTesting::ControllerMethodsdeftest_create# `post :create, name: "Hello, World!"` in Rails 4post:create,params:{name:"Hello, World!"}assert_equal200,response.statusendend

RSpec

RSpec.describeArticlesControllerdoprependRailsKwargsTesting::ControllerMethodsdescribe"#create"dosubjectdo# `post :create, name: "Hello, World!"` in Rails 4post:create,params:{name:"Hello, World!"}endit{is_expected.toeq200}endend

For request tests

Prepend RailsKwargsTesting::RequestMethods. Supported options are:

  • :env
  • :headers
  • :params

Minitest

classCreateArticleTest <ActionDispatch::IntegrationTestprepend ::RailsKwargsTesting::RequestMethodsdeftest_create_article# `post "/articles", name: "Hello, World!"` in Rails 4post"/articles",params:{name:"Hello, World!"}assert_equal200,response.statusendend

RSpec

RSpec.describe"POST /articles"doprependRailsKwargsTesting::RequestMethodssubjectdo# `post "/articles", name: "Hello, World!"` in Rails 4post"/articles",params:{name:"Hello, World!"}endit{is_expected.toeq200}end

Contributing

Bug reports and pull requests are welcome on GitHub athttps://github.com/r7kamura/rails_kwargs_testing.

License

The gem is available as open source under the terms of theMIT License.

About

Provides Rails 5 compatible testing methods for gradual migration from Rails 4 to 5.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp