Sha256: bfd4cde5ec73a8c48be6c5a054a7302962ca5b88df64472c5754d4d0cb8a049c

Contents?: true

Size: 1.28 KB

Versions: 70

Compression:

Stored size: 1.28 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

70 entries across 70 versions & 13 rubygems

Version Path
Flamefork-shoulda-2.10.1 test/other/convert_to_should_syntax_test.rb
Flamefork-shoulda-2.10.2 test/other/convert_to_should_syntax_test.rb
emschwar-shoulda-2.0.6.1 test/other/convert_to_should_syntax_test.rb
francois-shoulda-2.0.5.1 test/other/convert_to_should_syntax_test.rb
francois-shoulda-2.0.5.2 test/other/convert_to_should_syntax_test.rb
francois-shoulda-2.0.5.4 test/other/convert_to_should_syntax_test.rb
francois-shoulda-2.10.1 test/other/convert_to_should_syntax_test.rb
gsterndale-warrant-0.2.0 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.6/test/other/convert_to_should_syntax_test.rb
gsterndale-warrant-0.3.0 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.6/test/other/convert_to_should_syntax_test.rb
hashrocket-clearance-0.4.0 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/convert_to_should_syntax_test.rb
hashrocket-clearance-0.4.1 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/convert_to_should_syntax_test.rb
hashrocket-clearance-0.4.2 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/convert_to_should_syntax_test.rb
hashrocket-clearance-0.4.3 test/rails_root/vendor/gems/thoughtbot-shoulda-2.0.4/test/other/convert_to_should_syntax_test.rb
mattknox-goaloc-0.3.0 lib/goaloc/generators/resources/shoulda/test/other/convert_to_should_syntax_test.rb
mattknox-goaloc-0.4.0 lib/goaloc/generators/resources/shoulda/test/other/convert_to_should_syntax_test.rb
mjankowski-shoulda-2.0.4 test/other/convert_to_should_syntax_test.rb
mjankowski-shoulda-2.0.5 test/other/convert_to_should_syntax_test.rb
ratnikov-shoulda-2.0.6.1 test/other/convert_to_should_syntax_test.rb
ratnikov-shoulda-2.0.6.2 test/other/convert_to_should_syntax_test.rb
ratnikov-shoulda-2.0.6.3 test/other/convert_to_should_syntax_test.rb