mspec 1.5.1 → 1.5.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.
- data/Rakefile +1 -1
 - data/lib/mspec/helpers.rb +1 -0
 - data/lib/mspec/helpers/metaclass.rb +12 -0
 - data/lib/mspec/helpers/ruby_exe.rb +1 -1
 - data/lib/mspec/utils/script.rb +16 -7
 - data/lib/mspec/version.rb +1 -1
 - data/spec/helpers/metaclass_spec.rb +14 -0
 - data/spec/helpers/ruby_exe_spec.rb +1 -2
 - data/spec/utils/script_spec.rb +13 -9
 - metadata +5 -3
 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -16,7 +16,7 @@ spec = Gem::Specification.new do |s| 
     | 
|
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       18 
18 
     | 
    
         
             
              s.authors                   = ["Brian Ford"]
         
     | 
| 
       19 
     | 
    
         
            -
              s.date                      = %q{2008- 
     | 
| 
      
 19 
     | 
    
         
            +
              s.date                      = %q{2008-12-1}
         
     | 
| 
       20 
20 
     | 
    
         
             
              s.email                     = %q{bford@engineyard.com}
         
     | 
| 
       21 
21 
     | 
    
         
             
              s.has_rdoc                  = true
         
     | 
| 
       22 
22 
     | 
    
         
             
              s.extra_rdoc_files          = %w[ README LICENSE ]
         
     | 
    
        data/lib/mspec/helpers.rb
    CHANGED
    
    
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Provides a convenience method for accessing the metaclass
         
     | 
| 
      
 2 
     | 
    
         
            +
            # of any object without overriding the method if it already
         
     | 
| 
      
 3 
     | 
    
         
            +
            # exists in an implementation.
         
     | 
| 
      
 4 
     | 
    
         
            +
            unless respond_to? :metaclass
         
     | 
| 
      
 5 
     | 
    
         
            +
              class Object
         
     | 
| 
      
 6 
     | 
    
         
            +
                def metaclass
         
     | 
| 
      
 7 
     | 
    
         
            +
                  class << self
         
     | 
| 
      
 8 
     | 
    
         
            +
                    self
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/mspec/utils/script.rb
    CHANGED
    
    | 
         @@ -15,7 +15,6 @@ class MSpecScript 
     | 
|
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
              def initialize
         
     | 
| 
       18 
     | 
    
         
            -
                config[:tags_dir]  = 'spec/tags'
         
     | 
| 
       19 
18 
     | 
    
         
             
                config[:formatter] = nil
         
     | 
| 
       20 
19 
     | 
    
         
             
                config[:includes]  = []
         
     | 
| 
       21 
20 
     | 
    
         
             
                config[:excludes]  = []
         
     | 
| 
         @@ -35,10 +34,10 @@ class MSpecScript 
     | 
|
| 
       35 
34 
     | 
    
         
             
                MSpecScript.config
         
     | 
| 
       36 
35 
     | 
    
         
             
              end
         
     | 
| 
       37 
36 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
              def load( 
     | 
| 
       39 
     | 
    
         
            -
                names = [ 
     | 
| 
       40 
     | 
    
         
            -
                unless  
     | 
| 
       41 
     | 
    
         
            -
                  names <<  
     | 
| 
      
 37 
     | 
    
         
            +
              def load(target)
         
     | 
| 
      
 38 
     | 
    
         
            +
                names = [target]
         
     | 
| 
      
 39 
     | 
    
         
            +
                unless target[-6..-1] == config[:config_ext]
         
     | 
| 
      
 40 
     | 
    
         
            +
                  names << target + config[:config_ext]
         
     | 
| 
       42 
41 
     | 
    
         
             
                end
         
     | 
| 
       43 
42 
     | 
    
         | 
| 
       44 
43 
     | 
    
         
             
                names.each do |name|
         
     | 
| 
         @@ -51,6 +50,17 @@ class MSpecScript 
     | 
|
| 
       51 
50 
     | 
    
         
             
                end
         
     | 
| 
       52 
51 
     | 
    
         
             
              end
         
     | 
| 
       53 
52 
     | 
    
         | 
| 
      
 53 
     | 
    
         
            +
              def load_default
         
     | 
| 
      
 54 
     | 
    
         
            +
                if Object.const_defined?(:RUBY_ENGINE)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  engine = RUBY_ENGINE
         
     | 
| 
      
 56 
     | 
    
         
            +
                else
         
     | 
| 
      
 57 
     | 
    
         
            +
                  engine = 'ruby'
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
                version = RUBY_VERSION.split('.')[0,2].join('.')
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                load "#{engine}.#{version}.mspec"
         
     | 
| 
      
 62 
     | 
    
         
            +
              end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
       54 
64 
     | 
    
         
             
              def register
         
     | 
| 
       55 
65 
     | 
    
         
             
                if config[:formatter].nil?
         
     | 
| 
       56 
66 
     | 
    
         
             
                  config[:formatter] = @files.size < 50 ? DottedFormatter : FileFormatter
         
     | 
| 
         @@ -100,8 +110,7 @@ class MSpecScript 
     | 
|
| 
       100 
110 
     | 
    
         
             
              def self.main
         
     | 
| 
       101 
111 
     | 
    
         
             
                $VERBOSE = nil unless ENV['OUTPUT_WARNINGS']
         
     | 
| 
       102 
112 
     | 
    
         
             
                script = new
         
     | 
| 
       103 
     | 
    
         
            -
                script. 
     | 
| 
       104 
     | 
    
         
            -
                script.load RUBY_VERSION.split('.')[0,2].join('.') + ".mspec"
         
     | 
| 
      
 113 
     | 
    
         
            +
                script.load_default
         
     | 
| 
       105 
114 
     | 
    
         
             
                script.load '~/.mspecrc'
         
     | 
| 
       106 
115 
     | 
    
         
             
                script.options
         
     | 
| 
       107 
116 
     | 
    
         
             
                script.signals
         
     | 
    
        data/lib/mspec/version.rb
    CHANGED
    
    
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'mspec/helpers/metaclass'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            describe Object, "#metaclass" do
         
     | 
| 
      
 5 
     | 
    
         
            +
              it "returns the singleton class for an object" do
         
     | 
| 
      
 6 
     | 
    
         
            +
                obj = Object.new
         
     | 
| 
      
 7 
     | 
    
         
            +
                def obj.metaclass_test; end
         
     | 
| 
      
 8 
     | 
    
         
            +
                meta = obj.metaclass
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                meta.instance_methods(false).should include("metaclass_test")
         
     | 
| 
      
 11 
     | 
    
         
            +
                obj.should_not be_instance_of(meta)
         
     | 
| 
      
 12 
     | 
    
         
            +
                obj.should be_kind_of(meta)
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -98,10 +98,9 @@ describe Object, "#ruby_exe" do 
     | 
|
| 
       98 
98 
     | 
    
         
             
                $VERBOSE = @verbose
         
     | 
| 
       99 
99 
     | 
    
         
             
              end
         
     | 
| 
       100 
100 
     | 
    
         | 
| 
       101 
     | 
    
         
            -
              it "executes the argument if it is a file that exists 
     | 
| 
      
 101 
     | 
    
         
            +
              it "executes the argument if it is a file that exists" do
         
     | 
| 
       102 
102 
     | 
    
         
             
                code = "some/ruby/file.rb"
         
     | 
| 
       103 
103 
     | 
    
         
             
                File.should_receive(:exists?).with(code).and_return(true)
         
     | 
| 
       104 
     | 
    
         
            -
                File.should_receive(:executable?).with(code).and_return(true)
         
     | 
| 
       105 
104 
     | 
    
         
             
                @script.should_receive(:`).with("ruby_spec_exe -w -Q some/ruby/file.rb")
         
     | 
| 
       106 
105 
     | 
    
         
             
                @script.ruby_exe code
         
     | 
| 
       107 
106 
     | 
    
         
             
              end
         
     | 
    
        data/spec/utils/script_spec.rb
    CHANGED
    
    | 
         @@ -32,7 +32,7 @@ describe MSpecScript, "#config" do 
     | 
|
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
33 
     | 
    
         
             
            end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
     | 
    
         
            -
            describe MSpecScript, " 
     | 
| 
      
 35 
     | 
    
         
            +
            describe MSpecScript, "#load_default" do
         
     | 
| 
       36 
36 
     | 
    
         
             
              before :all do
         
     | 
| 
       37 
37 
     | 
    
         
             
                @verbose = $VERBOSE
         
     | 
| 
       38 
38 
     | 
    
         
             
                $VERBOSE = nil
         
     | 
| 
         @@ -44,19 +44,24 @@ describe MSpecScript, ".main" do 
     | 
|
| 
       44 
44 
     | 
    
         | 
| 
       45 
45 
     | 
    
         
             
              before :each do
         
     | 
| 
       46 
46 
     | 
    
         
             
                @version = RUBY_VERSION
         
     | 
| 
       47 
     | 
    
         
            -
                 
     | 
| 
      
 47 
     | 
    
         
            +
                if Object.const_defined? :RUBY_ENGINE
         
     | 
| 
      
 48 
     | 
    
         
            +
                  @engine = Object.const_get :RUBY_ENGINE
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
                @script = MSpecScript.new
         
     | 
| 
       48 
51 
     | 
    
         
             
                MSpecScript.stub!(:new).and_return(@script)
         
     | 
| 
       49 
52 
     | 
    
         
             
              end
         
     | 
| 
       50 
53 
     | 
    
         | 
| 
       51 
54 
     | 
    
         
             
              after :each do
         
     | 
| 
       52 
55 
     | 
    
         
             
                Object.const_set :RUBY_VERSION, @version
         
     | 
| 
      
 56 
     | 
    
         
            +
                Object.const_set :RUBY_ENGINE, @engine if @engine
         
     | 
| 
       53 
57 
     | 
    
         
             
              end
         
     | 
| 
       54 
58 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
              it "attempts to load a config file based on RUBY_VERSION" do
         
     | 
| 
      
 59 
     | 
    
         
            +
              it "attempts to load a config file based on RUBY_ENGINE and RUBY_VERSION" do
         
     | 
| 
      
 60 
     | 
    
         
            +
                Object.const_set :RUBY_ENGINE, "ybur"
         
     | 
| 
       56 
61 
     | 
    
         
             
                Object.const_set :RUBY_VERSION, "1.8.9"
         
     | 
| 
       57 
     | 
    
         
            -
                 
     | 
| 
       58 
     | 
    
         
            -
                @script.should_receive(:load).with( 
     | 
| 
       59 
     | 
    
         
            -
                 
     | 
| 
      
 62 
     | 
    
         
            +
                default = "ybur.1.8.mspec"
         
     | 
| 
      
 63 
     | 
    
         
            +
                @script.should_receive(:load).with(default)
         
     | 
| 
      
 64 
     | 
    
         
            +
                @script.load_default
         
     | 
| 
       60 
65 
     | 
    
         
             
              end
         
     | 
| 
       61 
66 
     | 
    
         
             
            end
         
     | 
| 
       62 
67 
     | 
    
         | 
| 
         @@ -71,8 +76,8 @@ describe MSpecScript, ".main" do 
     | 
|
| 
       71 
76 
     | 
    
         
             
                MSpecScript.main
         
     | 
| 
       72 
77 
     | 
    
         
             
              end
         
     | 
| 
       73 
78 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
              it "attempts to load the  
     | 
| 
       75 
     | 
    
         
            -
                @script.should_receive(: 
     | 
| 
      
 79 
     | 
    
         
            +
              it "attempts to load the default config" do
         
     | 
| 
      
 80 
     | 
    
         
            +
                @script.should_receive(:load_default)
         
     | 
| 
       76 
81 
     | 
    
         
             
                MSpecScript.main
         
     | 
| 
       77 
82 
     | 
    
         
             
              end
         
     | 
| 
       78 
83 
     | 
    
         | 
| 
         @@ -108,7 +113,6 @@ describe MSpecScript, "#initialize" do 
     | 
|
| 
       108 
113 
     | 
    
         
             
              end
         
     | 
| 
       109 
114 
     | 
    
         | 
| 
       110 
115 
     | 
    
         
             
              it "sets the default config values" do
         
     | 
| 
       111 
     | 
    
         
            -
                @config[:tags_dir].should   == 'spec/tags'
         
     | 
| 
       112 
116 
     | 
    
         
             
                @config[:formatter].should  == nil
         
     | 
| 
       113 
117 
     | 
    
         
             
                @config[:includes].should   == []
         
     | 
| 
       114 
118 
     | 
    
         
             
                @config[:excludes].should   == []
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: mspec
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.5.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Brian Ford
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2008- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2008-12-01 00:00:00 -08:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
         @@ -53,6 +53,7 @@ files: 
     | 
|
| 
       53 
53 
     | 
    
         
             
            - lib/mspec/helpers/const_lookup.rb
         
     | 
| 
       54 
54 
     | 
    
         
             
            - lib/mspec/helpers/flunk.rb
         
     | 
| 
       55 
55 
     | 
    
         
             
            - lib/mspec/helpers/io.rb
         
     | 
| 
      
 56 
     | 
    
         
            +
            - lib/mspec/helpers/metaclass.rb
         
     | 
| 
       56 
57 
     | 
    
         
             
            - lib/mspec/helpers/ruby_exe.rb
         
     | 
| 
       57 
58 
     | 
    
         
             
            - lib/mspec/helpers/scratch.rb
         
     | 
| 
       58 
59 
     | 
    
         
             
            - lib/mspec/helpers/tmp.rb
         
     | 
| 
         @@ -150,6 +151,7 @@ files: 
     | 
|
| 
       150 
151 
     | 
    
         
             
            - spec/helpers/const_lookup_spec.rb
         
     | 
| 
       151 
152 
     | 
    
         
             
            - spec/helpers/flunk_spec.rb
         
     | 
| 
       152 
153 
     | 
    
         
             
            - spec/helpers/io_spec.rb
         
     | 
| 
      
 154 
     | 
    
         
            +
            - spec/helpers/metaclass_spec.rb
         
     | 
| 
       153 
155 
     | 
    
         
             
            - spec/helpers/ruby_exe_spec.rb
         
     | 
| 
       154 
156 
     | 
    
         
             
            - spec/helpers/scratch_spec.rb
         
     | 
| 
       155 
157 
     | 
    
         
             
            - spec/helpers/tmp_spec.rb
         
     | 
| 
         @@ -233,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       233 
235 
     | 
    
         
             
            requirements: []
         
     | 
| 
       234 
236 
     | 
    
         | 
| 
       235 
237 
     | 
    
         
             
            rubyforge_project: http://rubyforge.org/projects/mspec
         
     | 
| 
       236 
     | 
    
         
            -
            rubygems_version: 1. 
     | 
| 
      
 238 
     | 
    
         
            +
            rubygems_version: 1.3.1
         
     | 
| 
       237 
239 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       238 
240 
     | 
    
         
             
            specification_version: 2
         
     | 
| 
       239 
241 
     | 
    
         
             
            summary: MSpec is a specialized framework that is syntax-compatible with RSpec for basic things like describe, it blocks and before, after actions.  MSpec contains additional features that assist in writing the RubySpecs used by multiple Ruby implementations. Also, MSpec attempts to use the simplest Ruby language features so that beginning Ruby implementations can run it.
         
     |