Sha256: 91396e2245747555d3f9c8301281c5c7ea90323ad8e7be109203a2d754636274

Contents?: true

Size: 1.29 KB

Versions: 39

Compression:

Stored size: 1.29 KB

Contents

require 'test/unit'

class ConvertToShouldSyntaxTest < ActiveSupport::TestCase # :nodoc:

  BEFORE_FIXTURE = <<-EOS
    class DummyTest < ActiveSupport::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 < ActiveSupport::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

39 entries across 39 versions & 10 rubygems

Version Path
auser-poolparty-1.3.0 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.1 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.10 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.11 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.12 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.13 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.14 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.15 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.16 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.17 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.2 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.3 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.4 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.5 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.6 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.7 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
auser-poolparty-1.3.8 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
fairchild-poolparty-1.3.17 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
fairchild-poolparty-1.3.5 vendor/gems/shoulda/test/other/convert_to_should_syntax_test.rb
iGEL-shoulda-2.10.2 test/other/convert_to_should_syntax_test.rb