single_test 0.3.6 → 0.3.7
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.
- data/Gemfile +5 -0
 - data/Gemfile.lock +23 -0
 - data/VERSION +1 -1
 - data/lib/single_test.rb +25 -5
 - data/single_test.gemspec +5 -3
 - data/spec/single_test_spec.rb +6 -6
 - metadata +5 -3
 
    
        data/Gemfile
    ADDED
    
    
    
        data/Gemfile.lock
    ADDED
    
    | 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            GEM
         
     | 
| 
      
 2 
     | 
    
         
            +
              remote: http://rubygems.org/
         
     | 
| 
      
 3 
     | 
    
         
            +
              specs:
         
     | 
| 
      
 4 
     | 
    
         
            +
                gemcutter (0.5.0)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  json_pure
         
     | 
| 
      
 6 
     | 
    
         
            +
                git (1.2.5)
         
     | 
| 
      
 7 
     | 
    
         
            +
                jeweler (1.4.0)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  gemcutter (>= 0.1.0)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  git (>= 1.2.5)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  rubyforge (>= 2.0.0)
         
     | 
| 
      
 11 
     | 
    
         
            +
                json_pure (1.4.3)
         
     | 
| 
      
 12 
     | 
    
         
            +
                rake (0.8.7)
         
     | 
| 
      
 13 
     | 
    
         
            +
                rspec (1.3.0)
         
     | 
| 
      
 14 
     | 
    
         
            +
                rubyforge (2.0.4)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  json_pure (>= 1.1.7)
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            PLATFORMS
         
     | 
| 
      
 18 
     | 
    
         
            +
              ruby
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            DEPENDENCIES
         
     | 
| 
      
 21 
     | 
    
         
            +
              jeweler
         
     | 
| 
      
 22 
     | 
    
         
            +
              rake
         
     | 
| 
      
 23 
     | 
    
         
            +
              rspec
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.3. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.3.7
         
     | 
    
        data/lib/single_test.rb
    CHANGED
    
    | 
         @@ -99,18 +99,38 @@ module SingleTest 
     | 
|
| 
       99 
99 
     | 
    
         
             
                end
         
     | 
| 
       100 
100 
     | 
    
         
             
              end
         
     | 
| 
       101 
101 
     | 
    
         | 
| 
      
 102 
     | 
    
         
            +
              # copied from parallel_tests http://github.com/grosser/parallel_tests/blob/master/lib/parallel_specs.rb#L9
         
     | 
| 
       102 
103 
     | 
    
         
             
              def spec_executable
         
     | 
| 
       103 
     | 
    
         
            -
                if File. 
     | 
| 
      
 104 
     | 
    
         
            +
                cmd = if File.file?("script/spec")
         
     | 
| 
       104 
105 
     | 
    
         
             
                  "script/spec"
         
     | 
| 
       105 
     | 
    
         
            -
                elsif  
     | 
| 
       106 
     | 
    
         
            -
                   
     | 
| 
       107 
     | 
    
         
            -
                  "bundle exec  
     | 
| 
      
 106 
     | 
    
         
            +
                elsif bundler_enabled?
         
     | 
| 
      
 107 
     | 
    
         
            +
                  cmd = (`bundle show rspec` =~ %r{/rspec-1[^/]+$} ? "spec" : "rspec")
         
     | 
| 
      
 108 
     | 
    
         
            +
                  "bundle exec #{cmd}"
         
     | 
| 
       108 
109 
     | 
    
         
             
                else
         
     | 
| 
       109 
     | 
    
         
            -
                   
     | 
| 
      
 110 
     | 
    
         
            +
                  %w[spec rspec].detect{|cmd| system "#{cmd} --version > /dev/null 2>&1" }
         
     | 
| 
       110 
111 
     | 
    
         
             
                end
         
     | 
| 
      
 112 
     | 
    
         
            +
                cmd or raise("Can't find executables rspec or spec")
         
     | 
| 
       111 
113 
     | 
    
         
             
              end
         
     | 
| 
       112 
114 
     | 
    
         | 
| 
       113 
115 
     | 
    
         
             
              def last_modified_file(dir, options={})
         
     | 
| 
       114 
116 
     | 
    
         
             
                Dir["#{dir}/**/*#{options[:ext]}"].sort_by { |p| File.mtime(p) }.last
         
     | 
| 
       115 
117 
     | 
    
         
             
              end
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
              private
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
              # copied from http://github.com/carlhuda/bundler Bundler::SharedHelpers#find_gemfile
         
     | 
| 
      
 122 
     | 
    
         
            +
              def self.bundler_enabled?
         
     | 
| 
      
 123 
     | 
    
         
            +
                return true if Object.const_defined?(:Bundler)
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
                previous = nil
         
     | 
| 
      
 126 
     | 
    
         
            +
                current = File.expand_path(Dir.pwd)
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                until !File.directory?(current) || current == previous
         
     | 
| 
      
 129 
     | 
    
         
            +
                  filename = File.join(current, "Gemfile")
         
     | 
| 
      
 130 
     | 
    
         
            +
                  return true if File.exists?(filename)
         
     | 
| 
      
 131 
     | 
    
         
            +
                  current, previous = File.expand_path("..", current), current
         
     | 
| 
      
 132 
     | 
    
         
            +
                end
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
                false
         
     | 
| 
      
 135 
     | 
    
         
            +
              end
         
     | 
| 
       116 
136 
     | 
    
         
             
            end
         
     | 
    
        data/single_test.gemspec
    CHANGED
    
    | 
         @@ -5,14 +5,16 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{single_test}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "0.3. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.3.7"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Michael Grosser"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = %q{2010- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2010-08-21}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.email = %q{grosser.michael@gmail.com}
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.files = [
         
     | 
| 
       15 
     | 
    
         
            -
                " 
     | 
| 
      
 15 
     | 
    
         
            +
                "Gemfile",
         
     | 
| 
      
 16 
     | 
    
         
            +
                 "Gemfile.lock",
         
     | 
| 
      
 17 
     | 
    
         
            +
                 "Rakefile",
         
     | 
| 
       16 
18 
     | 
    
         
             
                 "Readme.md",
         
     | 
| 
       17 
19 
     | 
    
         
             
                 "VERSION",
         
     | 
| 
       18 
20 
     | 
    
         
             
                 "lib/single_test.rb",
         
     | 
    
        data/spec/single_test_spec.rb
    CHANGED
    
    | 
         @@ -164,16 +164,16 @@ describe SingleTest do 
     | 
|
| 
       164 
164 
     | 
    
         
             
                  SingleTest.run_test('spec','xxx')
         
     | 
| 
       165 
165 
     | 
    
         
             
                end
         
     | 
| 
       166 
166 
     | 
    
         | 
| 
       167 
     | 
    
         
            -
                it "runs with spec if script/spec is not found" do
         
     | 
| 
       168 
     | 
    
         
            -
                  File.stub!(: 
     | 
| 
       169 
     | 
    
         
            -
                  File.should_receive(: 
     | 
| 
       170 
     | 
    
         
            -
                  SingleTest.should_receive(:sh).with('export RAILS_ENV=test ; spec xxx')
         
     | 
| 
      
 167 
     | 
    
         
            +
                it "runs with bundled spec if script/spec is not found" do
         
     | 
| 
      
 168 
     | 
    
         
            +
                  File.stub!(:file?).and_return false
         
     | 
| 
      
 169 
     | 
    
         
            +
                  File.should_receive(:file?).with('script/spec').and_return false
         
     | 
| 
      
 170 
     | 
    
         
            +
                  SingleTest.should_receive(:sh).with('export RAILS_ENV=test ; bundle exec spec xxx')
         
     | 
| 
       171 
171 
     | 
    
         
             
                  SingleTest.run_test('spec','xxx')
         
     | 
| 
       172 
172 
     | 
    
         
             
                end
         
     | 
| 
       173 
173 
     | 
    
         | 
| 
       174 
174 
     | 
    
         
             
                it "uses bundler if Gemfile is present" do
         
     | 
| 
       175 
     | 
    
         
            -
                  File.stub!(: 
     | 
| 
       176 
     | 
    
         
            -
                   
     | 
| 
      
 175 
     | 
    
         
            +
                  File.stub!(:file?).and_return false
         
     | 
| 
      
 176 
     | 
    
         
            +
                  SingleTest.should_receive(:bundler_enabled?).and_return true
         
     | 
| 
       177 
177 
     | 
    
         
             
                  SingleTest.should_receive(:sh).with('export RAILS_ENV=test ; bundle exec spec xxx')
         
     | 
| 
       178 
178 
     | 
    
         
             
                  SingleTest.run_test('spec','xxx')
         
     | 
| 
       179 
179 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version 
     | 
|
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 0
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 3
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
              version: 0.3. 
     | 
| 
      
 8 
     | 
    
         
            +
              - 7
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.3.7
         
     | 
| 
       10 
10 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       11 
11 
     | 
    
         
             
            authors: 
         
     | 
| 
       12 
12 
     | 
    
         
             
            - Michael Grosser
         
     | 
| 
         @@ -14,7 +14,7 @@ autorequire: 
     | 
|
| 
       14 
14 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       15 
15 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
            date: 2010- 
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2010-08-21 00:00:00 +02:00
         
     | 
| 
       18 
18 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       19 
19 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
         @@ -27,6 +27,8 @@ extensions: [] 
     | 
|
| 
       27 
27 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
            files: 
         
     | 
| 
      
 30 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 31 
     | 
    
         
            +
            - Gemfile.lock
         
     | 
| 
       30 
32 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       31 
33 
     | 
    
         
             
            - Readme.md
         
     | 
| 
       32 
34 
     | 
    
         
             
            - VERSION
         
     |