Sha256: d8056a7b0a805f8cb0ffd208e78166e26a5b330f0a704327f8bea0e410d4828e

Contents?: true

Size: 1.27 KB

Versions: 50

Compression:

Stored size: 1.27 KB

Contents

require 'test/unit'

class ConvertToShouldSyntaxTest < Test::Unit::TestCase # :nodoc:

  BEFORE_FIXTURE = <<-EOS
    class DummyTest < Test::Unit::TestCase

      should "Not change this_word_with_underscores" do
      end

      def test_should_be_working
        assert true
      end

      def test_some_cool_stuff
        assert true
      end

      def non_test_method
      end

    end
  EOS

  AFTER_FIXTURE = <<-EOS
    class DummyTest < Test::Unit::TestCase

      should "Not change this_word_with_underscores" do
      end

      should "be working" do
        assert true
      end

      should "RENAME ME: test some cool stuff" do
        assert true
      end

      def non_test_method
      end

    end
  EOS

  FIXTURE_PATH = "./convert_to_should_syntax_fixture.dat"

  RUBY = ENV['RUBY'] || 'ruby'

  def test_convert_to_should_syntax
    File.open(FIXTURE_PATH, "w") {|f| f.write(BEFORE_FIXTURE)}
    cmd = "#{RUBY} #{File.join(File.dirname(__FILE__), '../../bin/convert_to_should_syntax')} #{FIXTURE_PATH}"
    output = `#{cmd}`
    File.unlink($1) if output.match(/has been stored in '([^']+)/)
    assert_match(/has been converted/, output)
    result = IO.read(FIXTURE_PATH)
    assert_equal result, AFTER_FIXTURE
  end

  def teardown
    File.unlink(FIXTURE_PATH)
  end

end

Version data entries

50 entries across 40 versions & 6 rubygems

Version Path
shoulda-context-1.2.2 test/shoulda/convert_to_should_syntax_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-context-1.2.1/test/shoulda/convert_to_should_syntax_test.rb
shoulda-context-1.2.1 test/shoulda/convert_to_should_syntax_test.rb
shoulda-context-1.2.0 test/shoulda/convert_to_should_syntax_test.rb
vtd_xml-0.0.3-java bundle/jruby/1.9/gems/shoulda-context-1.1.6/test/shoulda/convert_to_should_syntax_test.rb
shoulda-context-1.1.6 test/shoulda/convert_to_should_syntax_test.rb
shoulda-context-1.1.5 test/shoulda/convert_to_should_syntax_test.rb
challah-1.0.0 vendor/bundle/gems/shoulda-context-1.1.3/test/shoulda/convert_to_should_syntax_test.rb
shoulda-context-1.1.4 test/shoulda/convert_to_should_syntax_test.rb
shoulda-context-1.1.3 test/shoulda/convert_to_should_syntax_test.rb
shoulda-context-1.1.2 test/shoulda/convert_to_should_syntax_test.rb
challah-1.0.0.beta3 vendor/bundle/gems/shoulda-context-1.1.1/test/shoulda/convert_to_should_syntax_test.rb
challah-1.0.0.beta3 vendor/bundle/gems/shoulda-context-1.1.0/test/shoulda/convert_to_should_syntax_test.rb
challah-1.0.0.beta2 vendor/bundle/gems/shoulda-context-1.1.0/test/shoulda/convert_to_should_syntax_test.rb
challah-1.0.0.beta2 vendor/bundle/gems/shoulda-context-1.1.1/test/shoulda/convert_to_should_syntax_test.rb
shoulda-context-1.1.1 test/shoulda/convert_to_should_syntax_test.rb
challah-1.0.0.beta vendor/bundle/gems/shoulda-context-1.0.2/test/shoulda/convert_to_should_syntax_test.rb
challah-1.0.0.beta vendor/bundle/gems/shoulda-context-1.0.1/test/shoulda/convert_to_should_syntax_test.rb
challah-1.0.0.beta vendor/bundle/gems/shoulda-context-1.1.0/test/shoulda/convert_to_should_syntax_test.rb
shoulda-context-1.1.0 test/shoulda/convert_to_should_syntax_test.rb