Skip to content

Instantly share code, notes, and snippets.

@puyo
Created November 14, 2013 23:22
Show Gist options
  • Save puyo/7476232 to your computer and use it in GitHub Desktop.
Save puyo/7476232 to your computer and use it in GitHub Desktop.
Madness. Complete madness. But it mostly worked. A ghetto version of https://github.com/yujinakayama/transpec ;-)
require 'pathname'
system('git checkout .')
Pathname.glob('spec/**/*_spec.rb') do |path|
#next if path.to_s.match(/tsa_open_period_spec|tutor_earning_spec|tutoring_service_agreement_spec|presence_spec/)
content = path.read
content.gsub!(/\.should ==\s*(.+?)(\s#\s|$)/, %q{.should eq(\1)\2})
content.gsub!(/\.should_not ==\s*(.+?)(\s#\s|$)/, %q{.should_not eq(\1)\2})
# content.gsub!(/^(\s*)(.+)\.should_not_receive/, %q{\1expect(\2).not_to receive})
# content.gsub!(/^(\s*)(.+)\.should_receive/, %q{\1expect(\2).to receive})
content.gsub!(/lambda\s*({.+?}).should_not(\s+)/m, %q{expect\1.not_to\2})
content.gsub!(/lambda\s*({.+?}).should(\s+)/m, %q{expect\1.to\2})
content.gsub!(/^(\s*)(.+)\.should_not(\s+)/, %q{\1expect(\2).not_to\3})
content.gsub!(/^(\s*)(.+)\.should(\s+)/, %q{\1expect(\2).to\3})
path.open('w') { |f| f << content }
end
system('git diff')
@puyo
Copy link
Author

puyo commented Nov 14, 2013

THANKS FOR NOT HOT LINKING THAT LINK GH

https://github.com/yujinakayama/transpec

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