Skip to content

Migrate all common matchers from rspec2minitest to Processor #1

Description

@pftg
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/system_helper/application_system_test_case/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/rails_helper/test_helper/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/spec_helper/test_helper/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/context/describe/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/stub(/stubs(/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/double/stub/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/should_receive/expects/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/and_return/returns/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to be ==/.must_equal/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to be_empty/.must_be_empty/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to_not be_empty/.wont_be_empty/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to be_truthy/.must_be :present?/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to be_falsey/.must_be :blank?/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.not_to be_nil/.wont_be_nil/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to_not be_nil/.wont_be_nil/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.not_to be_an_\(.*\)/.wont_be :\1\?/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to be_a(/.must_be_kind_of(/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to be_an(/.must_be_kind_of(/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to be_an_\(.*\)/.must_be :\1\?/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to_not be_\(.*\)/.wont_be :\1\?/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.not_to be_\(.*\)/.wont_be :\1\?/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to be_\(.*\)/.must_be :\1\?/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to be_nil/.must_be_nil/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to eq/.must_equal/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.not_to eq/.wont_equal/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to_not eq/.wont_equal/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.not_to include/.wont_include/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to_not include/.wont_include/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to include/.must_include/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/\.to be_kind_of/.must_be_kind_of/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/expect(response).to have_http_status/assert_response/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to redirect_to/.must_redirect_to/g' {} \;
find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to match/.must_match/g' {} \;

find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to have_content/assert_text/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to have_no_content/assert_no_text/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to_not have_content/assert_no_text/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to have_selector/assert_selector/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.not_to have_selector/assert_no_selector/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to_not have_selector/assert_no_selector/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_content/.must_have_content/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.not_to have_content/.wont_have_content/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_no_content/.wont_have_content/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_field/.must_have_field/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to have_checked_field/assert_checked_field/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.not_to have_checked_field/assert_no_checked_field/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/expect(page)\.to_not have_checked_field/assert_no_checked_field/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_link/.must_have_link/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_no_link/.wont_have_link/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_button/.must_have_button/g' {} \;
find $tests_path -path '*/system/*' -name '*_spec.rb' -exec sed -i '' 's/\.to have_no_button/.wont_have_button/g' {} \;

find $tests_path -name '*_spec.rb' -exec sed -i '' 's/.to match/.must_match/g' {} \;

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions