test_diff 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/test_diff/build_coverage_diff.rb +27 -19
- data/lib/test_diff/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                NjM2ODkxNDEwZmVmNzYxNmE5ZTZhZTUzNzBjMjgzYWM5NTZjMjQ3Ng==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                ZjY5Mjk3MWRkZDA5NThiNDM4OWIwMjdkODAzZmZkMDg1NTIyZTBjOQ==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                NzI1NTBjYzc1NTI5YjNiYjZlN2VjZGZlYmQ3YzA5M2Q0ODczM2MzY2Y4Mzc5
         | 
| 10 | 
            +
                NWQzYzNlMTlmMWFkYTdiNWI3ZTMyOTFlYzRmZDY2ZDFkZThmYjFiZDJlMzA3
         | 
| 11 | 
            +
                ZTRhMDkxZGZjODg2MThmODczZjk5MTFjMmU5OWYzMTliNTIyYTM=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                ODAyOTMzMDY4ZjVlM2RkMDhlZDQyYjdkNGMwZjRiOGUzZmMwNjBiN2QxOGZh
         | 
| 14 | 
            +
                ODQ3ZTcyYzFlMDE0ZThmNTAwNWM2MzRhZTE3ZDIyMzJkNWZhNzM5MWUyNjMz
         | 
| 15 | 
            +
                ZmNiN2Q0YTExN2I2MmVkMDA3MDU2NmUzN2I1YmU1MzBkNThjZjU=
         | 
| @@ -57,7 +57,7 @@ module TestDiff | |
| 57 57 |  | 
| 58 58 | 
             
                def start
         | 
| 59 59 | 
             
                  until @tests_to_run.empty?
         | 
| 60 | 
            -
                    pid = start_process_fork(@tests_to_run.pop)
         | 
| 60 | 
            +
                    pid = start_process_fork(@tests_to_run.pop.filename)
         | 
| 61 61 | 
             
                    pid, status =  Process.waitpid2(pid)
         | 
| 62 62 | 
             
                    fail 'Test Failed' unless status.success?
         | 
| 63 63 | 
             
                  end
         | 
| @@ -69,29 +69,37 @@ module TestDiff | |
| 69 69 | 
             
                    puts "running #{main_spec_file}"
         | 
| 70 70 | 
             
                    ActiveRecord::Base.connection.reconnect! if defined?(ActiveRecord::Base)
         | 
| 71 71 | 
             
                    Time.zone_default = (Time.zone = 'UTC') if Time.respond_to?(:zone_default) && Time.zone_default.nil?
         | 
| 72 | 
            -
                     | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 72 | 
            +
                    run_test(main_spec_file)
         | 
| 73 | 
            +
                  end
         | 
| 74 | 
            +
                end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                def run_test(main_spec_file)
         | 
| 77 | 
            +
                  s = Time.now
         | 
| 78 | 
            +
                  result = run_tests(main_spec_file)
         | 
| 79 | 
            +
                  if result
         | 
| 80 | 
            +
                    save_coverage_data(main_spec_file, Time.now - s)
         | 
| 81 | 
            +
                  else
         | 
| 82 | 
            +
                    Coverage.result # disable coverage
         | 
| 83 | 
            +
                    exit!(false) unless @continue
         | 
| 80 84 | 
             
                  end
         | 
| 81 85 | 
             
                end
         | 
| 82 86 |  | 
| 83 87 | 
             
                def run_tests(main_spec_file)
         | 
| 84 | 
            -
                   | 
| 85 | 
            -
                     | 
| 86 | 
            -
             | 
| 87 | 
            -
                     | 
| 88 | 
            +
                  if defined?(::RSpec::Core::Runner)
         | 
| 89 | 
            +
                    ::RSpec::Core::Runner.run([main_spec_file], $stderr, $stdout) == 0
         | 
| 90 | 
            +
                  else
         | 
| 91 | 
            +
                    options ||= begin
         | 
| 92 | 
            +
                      parser = ::Spec::Runner::OptionParser.new($stderr, $stdout)
         | 
| 93 | 
            +
                      parser.order!(['-b', main_spec_file])
         | 
| 94 | 
            +
                      parser.options
         | 
| 95 | 
            +
                    end
         | 
| 96 | 
            +
                    Spec::Runner.use options
         | 
| 97 | 
            +
                    options.run_examples
         | 
| 88 98 | 
             
                  end
         | 
| 89 | 
            -
                  Spec::Runner.use options
         | 
| 90 | 
            -
                  options.run_examples
         | 
| 91 99 | 
             
                end
         | 
| 92 100 |  | 
| 93 | 
            -
                def save_coverage_data(main_spec_file)
         | 
| 94 | 
            -
                  data = {}
         | 
| 101 | 
            +
                def save_coverage_data(main_spec_file, execution_time)
         | 
| 102 | 
            +
                  data = { '__execution_time__' => execution_time }
         | 
| 95 103 | 
             
                  Coverage.result.each do |file_name, stats|
         | 
| 96 104 | 
             
                    relative_file_name = file_name.gsub("#{FileUtils.pwd}/", '')
         | 
| 97 105 | 
             
                    if file_name.include?(FileUtils.pwd)
         | 
| @@ -105,13 +113,13 @@ module TestDiff | |
| 105 113 |  | 
| 106 114 | 
             
                def remove_tests_that_do_not_exist
         | 
| 107 115 | 
             
                  @tests_to_run.delete_if do |s|
         | 
| 108 | 
            -
                    !File.exist?(s)
         | 
| 116 | 
            +
                    !File.exist?("#{Config.working_directory}/#{s.filename}")
         | 
| 109 117 | 
             
                  end
         | 
| 110 118 | 
             
                end
         | 
| 111 119 |  | 
| 112 120 | 
             
                def remove_tests_in_wrong_folder
         | 
| 113 121 | 
             
                  @tests_to_run.delete_if do |s|
         | 
| 114 | 
            -
                    !s.start_with?("#{spec_folder}/")
         | 
| 122 | 
            +
                    !s.filename.start_with?("#{spec_folder}/")
         | 
| 115 123 | 
             
                  end
         | 
| 116 124 | 
             
                end
         | 
| 117 125 | 
             
              end
         | 
    
        data/lib/test_diff/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: test_diff
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.3. | 
| 4 | 
            +
              version: 0.3.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Grant Speelman
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015- | 
| 11 | 
            +
            date: 2015-04-01 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: thor
         |