remarkable 3.1.2 → 3.1.3
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/CHANGELOG +2 -0
- data/lib/remarkable/matchers.rb +13 -1
- data/lib/remarkable/pending.rb +61 -57
- data/lib/remarkable/version.rb +1 -1
- data/spec/base_spec.rb +7 -1
- data/spec/dsl/optionals_spec.rb +162 -161
- data/spec/messages_spec.rb +1 -0
- data/spec/spec_helper.rb +0 -1
- metadata +2 -2
    
        data/CHANGELOG
    CHANGED
    
    
    
        data/lib/remarkable/matchers.rb
    CHANGED
    
    | @@ -9,7 +9,15 @@ module Remarkable | |
| 9 9 | 
             
              # If the module to be included responds to :after_include, it's called with the
         | 
| 10 10 | 
             
              # target as argument.
         | 
| 11 11 | 
             
              #
         | 
| 12 | 
            -
              def self.include_matchers!(base, target)
         | 
| 12 | 
            +
              def self.include_matchers!(base, target=nil)
         | 
| 13 | 
            +
                if target.nil?
         | 
| 14 | 
            +
                  if rspec_defined?
         | 
| 15 | 
            +
                    target = Spec::Example::ExampleGroup
         | 
| 16 | 
            +
                  else
         | 
| 17 | 
            +
                    raise ArgumentError, "You haven't supplied the target to include_matchers! and RSpec is not loaded, so we cannot infer one."
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
             | 
| 13 21 | 
             
                target.send :extend, Remarkable::Pending
         | 
| 14 22 | 
             
                target.send :extend, Remarkable::Macros
         | 
| 15 23 |  | 
| @@ -23,5 +31,9 @@ module Remarkable | |
| 23 31 | 
             
                if base.respond_to?(:after_include)
         | 
| 24 32 | 
             
                  base.after_include(target)
         | 
| 25 33 | 
             
                end
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              def self.rspec_defined? #:nodoc:
         | 
| 37 | 
            +
                defined?(Spec)
         | 
| 26 38 | 
             
              end
         | 
| 27 39 | 
             
            end
         | 
    
        data/lib/remarkable/pending.rb
    CHANGED
    
    | @@ -1,62 +1,66 @@ | |
| 1 1 | 
             
            module Remarkable
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
                #  | 
| 6 | 
            -
                #
         | 
| 7 | 
            -
                 | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
                     | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
                 | 
| 16 | 
            -
             | 
| 17 | 
            -
                #
         | 
| 18 | 
            -
                # | 
| 19 | 
            -
                # | 
| 20 | 
            -
                # | 
| 21 | 
            -
                #    | 
| 22 | 
            -
                #
         | 
| 23 | 
            -
                #  | 
| 24 | 
            -
                # | 
| 25 | 
            -
                # | 
| 26 | 
            -
                #  | 
| 27 | 
            -
                #
         | 
| 28 | 
            -
                # | 
| 2 | 
            +
             | 
| 3 | 
            +
              module Pending
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                # We cannot put the alias method in the module because it's a Ruby 1.8 bug
         | 
| 6 | 
            +
                # http://coderrr.wordpress.com/2008/03/28/alias_methodmodule-bug-in-ruby-18/
         | 
| 7 | 
            +
                #
         | 
| 8 | 
            +
                def self.extended(base) #:nodoc:
         | 
| 9 | 
            +
                  class << base
         | 
| 10 | 
            +
                    alias_method :example_without_pending, :example
         | 
| 11 | 
            +
                    alias_method :example, :example_with_pending
         | 
| 12 | 
            +
                    alias :it :example
         | 
| 13 | 
            +
                    alias :specify :example
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                # Adds a pending block to your specs.
         | 
| 18 | 
            +
                #
         | 
| 19 | 
            +
                # == Examples
         | 
| 20 | 
            +
                #
         | 
| 21 | 
            +
                #   pending 'create manager resource' do
         | 
| 22 | 
            +
                #     should_have_one :manager
         | 
| 23 | 
            +
                #     should_validate_associated :manager
         | 
| 24 | 
            +
                #   end
         | 
| 25 | 
            +
                #
         | 
| 26 | 
            +
                # By default, it executes the examples inside the pending block. So as soon
         | 
| 27 | 
            +
                # as you add the has_one :manager relationship to your model, your specs
         | 
| 28 | 
            +
                # will say that this was already fixed and there is no need to be treated
         | 
| 29 | 
            +
                # as pending. To disable this behavior, you can give :execute => false:
         | 
| 30 | 
            +
                #
         | 
| 31 | 
            +
                #   pending 'create manager resource', :execute => false
         | 
| 29 32 | 
             
                #
         | 
| 30 | 
            -
                def pending(*args, &block)
         | 
| 31 | 
            -
                  options = { :execute => true }.merge(args.extract_options!)
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                  @_pending_group = true
         | 
| 34 | 
            -
                  @_pending_group_description = args.first || "TODO"
         | 
| 35 | 
            -
                  @_pending_group_execute = options.delete(:execute)
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                  self.instance_eval(&block)
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                  @_pending_group = false
         | 
| 40 | 
            -
                  @_pending_group_description = nil
         | 
| 41 | 
            -
                  @_pending_group_execute = nil
         | 
| 42 | 
            -
                end
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                def  | 
| 45 | 
            -
                  if block_given? && @_pending_group
         | 
| 46 | 
            -
                    pending_caller      = caller.detect{ |c| c !~ /method_missing'/ }
         | 
| 47 | 
            -
                    pending_description = @_pending_group_description
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                    pending_block = if @_pending_group_execute
         | 
| 50 | 
            -
                      proc{ pending(pending_description){ self.instance_eval(&implementation) } }
         | 
| 51 | 
            -
                    else
         | 
| 52 | 
            -
                      proc{ pending(pending_description) }
         | 
| 53 | 
            -
                    end
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                     | 
| 56 | 
            -
                  else
         | 
| 57 | 
            -
                     | 
| 58 | 
            -
                  end
         | 
| 59 | 
            -
                end
         | 
| 33 | 
            +
                def pending(*args, &block)
         | 
| 34 | 
            +
                  options = { :execute => true }.merge(args.extract_options!)
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  @_pending_group = true
         | 
| 37 | 
            +
                  @_pending_group_description = args.first || "TODO"
         | 
| 38 | 
            +
                  @_pending_group_execute = options.delete(:execute)
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                  self.instance_eval(&block)
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  @_pending_group = false
         | 
| 43 | 
            +
                  @_pending_group_description = nil
         | 
| 44 | 
            +
                  @_pending_group_execute = nil
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                def example_with_pending(description=nil, options={}, backtrace=nil, &implementation) #:nodoc:
         | 
| 48 | 
            +
                  if block_given? && @_pending_group
         | 
| 49 | 
            +
                    pending_caller      = caller.detect{ |c| c !~ /method_missing'/ }
         | 
| 50 | 
            +
                    pending_description = @_pending_group_description
         | 
| 51 | 
            +
             | 
| 52 | 
            +
                    pending_block = if @_pending_group_execute
         | 
| 53 | 
            +
                      proc{ pending(pending_description){ self.instance_eval(&implementation) } }
         | 
| 54 | 
            +
                    else
         | 
| 55 | 
            +
                      proc{ pending(pending_description) }
         | 
| 56 | 
            +
                    end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                    example_without_pending(description, options, backtrace || pending_caller, &pending_block)
         | 
| 59 | 
            +
                  else
         | 
| 60 | 
            +
                    example_without_pending(description, options, backtrace || caller(0)[1], &implementation)
         | 
| 61 | 
            +
                  end
         | 
| 62 | 
            +
                end
         | 
| 60 63 |  | 
| 61 64 | 
             
              end
         | 
| 65 | 
            +
             | 
| 62 66 | 
             
            end
         | 
    
        data/lib/remarkable/version.rb
    CHANGED
    
    
    
        data/spec/base_spec.rb
    CHANGED
    
    | @@ -38,5 +38,11 @@ describe Remarkable::Base do | |
| 38 38 | 
             
              it 'should allow Macros and Matchers to be added to any class' do
         | 
| 39 39 | 
             
                MatchersSandbox.new.should respond_to(:contain)
         | 
| 40 40 | 
             
              end
         | 
| 41 | 
            -
             | 
| 41 | 
            +
             | 
| 42 | 
            +
              it 'should raise an error if include matchers is called without target and rspec is not loaded' do
         | 
| 43 | 
            +
                Remarkable.stub!(:rspec_defined?).and_return(false)
         | 
| 44 | 
            +
                lambda {
         | 
| 45 | 
            +
                  Remarkable.include_matchers!(String)
         | 
| 46 | 
            +
                }.should raise_error(ArgumentError, "You haven't supplied the target to include_matchers! and RSpec is not loaded, so we cannot infer one.")
         | 
| 47 | 
            +
              end
         | 
| 42 48 | 
             
            end
         | 
    
        data/spec/dsl/optionals_spec.rb
    CHANGED
    
    | @@ -1,22 +1,23 @@ | |
| 1 | 
            +
            # encoding: utf-8
         | 
| 1 2 | 
             
            require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
         | 
| 2 3 |  | 
| 3 | 
            -
            describe Remarkable::DSL::Optionals do
         | 
| 4 | 
            -
             | 
| 4 | 
            +
            describe Remarkable::DSL::Optionals do
         | 
| 5 | 
            +
             | 
| 5 6 | 
             
              describe "without config blocks" do
         | 
| 6 | 
            -
             | 
| 7 | 
            +
             | 
| 7 8 | 
             
                before(:each) do
         | 
| 8 9 | 
             
                  @matcher = Remarkable::Specs::Matchers::BeAPersonMatcher.new
         | 
| 9 | 
            -
                end
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                describe "as optionals" do
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                describe "as optionals" do
         | 
| 12 13 | 
             
                  it "should allow optionals to be set" do
         | 
| 13 14 | 
             
                    @matcher.first_name('José')
         | 
| 14 15 | 
             
                    @matcher.options[:first_name].should == 'José'
         | 
| 15 16 |  | 
| 16 17 | 
             
                    @matcher.last_name('Valim')
         | 
| 17 18 | 
             
                    @matcher.options[:last_name].should == 'Valim'
         | 
| 18 | 
            -
                  end
         | 
| 19 | 
            -
             | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
             | 
| 20 21 | 
             
                  it "should allow defaults values" do
         | 
| 21 22 | 
             
                    @matcher.age
         | 
| 22 23 | 
             
                    @matcher.options[:age].should == 18
         | 
| @@ -25,173 +26,173 @@ describe Remarkable::DSL::Optionals do | |
| 25 26 | 
             
                  it "should allow alias to be set" do
         | 
| 26 27 | 
             
                    @matcher.family_name('Valim')
         | 
| 27 28 | 
             
                    @matcher.options[:last_name].should == 'Valim'
         | 
| 28 | 
            -
                  end
         | 
| 29 | 
            -
             | 
| 30 | 
            -
                  it "should allow multiple options to be given" do
         | 
| 31 | 
            -
                    @matcher.bands(:incubus, :foo_fighters)
         | 
| 32 | 
            -
                    @matcher.options[:bands].should == [:incubus, :foo_fighters]
         | 
| 33 | 
            -
                  end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                  it "should allow multiple options to be appended once at a time" do
         | 
| 36 | 
            -
                    @matcher.bands(:incubus)
         | 
| 37 | 
            -
                    @matcher.bands(:foo_fighters)
         | 
| 38 | 
            -
                    @matcher.options[:bands].should == [:incubus, :foo_fighters]
         | 
| 39 | 
            -
                  end
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                  it "should allow blocks to given to options" do
         | 
| 42 | 
            -
                    @matcher.builder {|i| i + 10 }
         | 
| 43 | 
            -
                    @matcher.options[:builder].call(10).should == 20
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                    @matcher.builder proc{|i| i + 20 }
         | 
| 46 | 
            -
                    @matcher.options[:builder].call(10).should == 30
         | 
| 47 | 
            -
                  end
         | 
| 48 | 
            -
                end
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                describe "as optionals=" do
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  it "should allow multiple options to be given" do
         | 
| 32 | 
            +
                    @matcher.bands(:incubus, :foo_fighters)
         | 
| 33 | 
            +
                    @matcher.options[:bands].should == [:incubus, :foo_fighters]
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  it "should allow multiple options to be appended once at a time" do
         | 
| 37 | 
            +
                    @matcher.bands(:incubus)
         | 
| 38 | 
            +
                    @matcher.bands(:foo_fighters)
         | 
| 39 | 
            +
                    @matcher.options[:bands].should == [:incubus, :foo_fighters]
         | 
| 40 | 
            +
                  end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  it "should allow blocks to given to options" do
         | 
| 43 | 
            +
                    @matcher.builder {|i| i + 10 }
         | 
| 44 | 
            +
                    @matcher.options[:builder].call(10).should == 20
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                    @matcher.builder proc{|i| i + 20 }
         | 
| 47 | 
            +
                    @matcher.options[:builder].call(10).should == 30
         | 
| 48 | 
            +
                  end
         | 
| 49 | 
            +
                end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                describe "as optionals=" do
         | 
| 51 52 | 
             
                  it "should allow optionals to be set" do
         | 
| 52 53 | 
             
                    @matcher.first_name = 'José'
         | 
| 53 54 | 
             
                    @matcher.options[:first_name].should == 'José'
         | 
| 54 55 |  | 
| 55 56 | 
             
                    @matcher.last_name = 'Valim'
         | 
| 56 57 | 
             
                    @matcher.options[:last_name].should == 'Valim'
         | 
| 57 | 
            -
                  end
         | 
| 58 | 
            -
             | 
| 58 | 
            +
                  end
         | 
| 59 | 
            +
             | 
| 59 60 | 
             
                  it "should allow alias to be set" do
         | 
| 60 61 | 
             
                    @matcher.family_name = 'Valim'
         | 
| 61 62 | 
             
                    @matcher.options[:last_name].should == 'Valim'
         | 
| 62 | 
            -
                  end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
                  it "should allow multiple options to be given" do
         | 
| 65 | 
            -
                    @matcher.bands = [ :incubus, :foo_fighters ]
         | 
| 66 | 
            -
                    @matcher.options[:bands].should == [ :incubus, :foo_fighters ]
         | 
| 67 | 
            -
                  end
         | 
| 68 | 
            -
             | 
| 69 | 
            -
                  it "should overwrite previous options" do
         | 
| 70 | 
            -
                    @matcher.bands = [ :incubus ]
         | 
| 71 | 
            -
                    @matcher.bands = [ :foo_fighters ]
         | 
| 72 | 
            -
                    @matcher.options[:bands].should == [:foo_fighters]
         | 
| 73 | 
            -
                  end
         | 
| 74 | 
            -
             | 
| 75 | 
            -
                  it "should allow blocks to given to options" do
         | 
| 76 | 
            -
                    @matcher.builder = proc{|i| i + 20 }
         | 
| 77 | 
            -
                    @matcher.options[:builder].call(10).should == 30
         | 
| 78 | 
            -
                  end
         | 
| 79 | 
            -
                end
         | 
| 80 | 
            -
             | 
| 81 | 
            -
              end
         | 
| 82 | 
            -
             | 
| 63 | 
            +
                  end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                  it "should allow multiple options to be given" do
         | 
| 66 | 
            +
                    @matcher.bands = [ :incubus, :foo_fighters ]
         | 
| 67 | 
            +
                    @matcher.options[:bands].should == [ :incubus, :foo_fighters ]
         | 
| 68 | 
            +
                  end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                  it "should overwrite previous options" do
         | 
| 71 | 
            +
                    @matcher.bands = [ :incubus ]
         | 
| 72 | 
            +
                    @matcher.bands = [ :foo_fighters ]
         | 
| 73 | 
            +
                    @matcher.options[:bands].should == [:foo_fighters]
         | 
| 74 | 
            +
                  end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                  it "should allow blocks to given to options" do
         | 
| 77 | 
            +
                    @matcher.builder = proc{|i| i + 20 }
         | 
| 78 | 
            +
                    @matcher.options[:builder].call(10).should == 30
         | 
| 79 | 
            +
                  end
         | 
| 80 | 
            +
                end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
              end
         | 
| 83 | 
            +
             | 
| 83 84 | 
             
              describe "with config blocks" do
         | 
| 84 | 
            -
             | 
| 85 | 
            -
                def builder(*args, &block)
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                def builder(*args, &block)
         | 
| 86 87 | 
             
                  Remarkable::Specs::Matchers::BeAPersonMatcher.new(*args, &block)
         | 
| 87 | 
            -
                end
         | 
| 88 | 
            -
             | 
| 89 | 
            -
                describe "as optionals" do
         | 
| 90 | 
            -
                  it "should allow optionals to be set" do
         | 
| 91 | 
            -
                    matcher = builder do |m|
         | 
| 92 | 
            -
                      m.first_name 'José'
         | 
| 93 | 
            -
                      m.last_name 'Valim'
         | 
| 88 | 
            +
                end
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                describe "as optionals" do
         | 
| 91 | 
            +
                  it "should allow optionals to be set" do
         | 
| 92 | 
            +
                    matcher = builder do |m|
         | 
| 93 | 
            +
                      m.first_name 'José'
         | 
| 94 | 
            +
                      m.last_name 'Valim'
         | 
| 94 95 | 
             
                    end
         | 
| 95 | 
            -
             | 
| 96 | 
            +
             | 
| 96 97 | 
             
                    matcher.options[:first_name].should == 'José'
         | 
| 97 98 | 
             
                    matcher.options[:last_name].should == 'Valim'
         | 
| 98 | 
            -
                  end
         | 
| 99 | 
            -
             | 
| 100 | 
            -
                  it "should allow defaults values" do
         | 
| 101 | 
            -
                    matcher = builder do |m|
         | 
| 102 | 
            -
                      m.age
         | 
| 103 | 
            -
                    end
         | 
| 99 | 
            +
                  end
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                  it "should allow defaults values" do
         | 
| 102 | 
            +
                    matcher = builder do |m|
         | 
| 103 | 
            +
                      m.age
         | 
| 104 | 
            +
                    end
         | 
| 104 105 |  | 
| 105 106 | 
             
                    matcher.options[:age].should == 18
         | 
| 106 107 | 
             
                  end
         | 
| 107 108 |  | 
| 108 | 
            -
                  it "should allow alias to be set" do
         | 
| 109 | 
            -
                    matcher = builder do |m|
         | 
| 110 | 
            -
                      m.family_name 'Valim'
         | 
| 111 | 
            -
                    end
         | 
| 109 | 
            +
                  it "should allow alias to be set" do
         | 
| 110 | 
            +
                    matcher = builder do |m|
         | 
| 111 | 
            +
                      m.family_name 'Valim'
         | 
| 112 | 
            +
                    end
         | 
| 112 113 |  | 
| 113 114 | 
             
                    matcher.options[:last_name].should == 'Valim'
         | 
| 114 | 
            -
                  end
         | 
| 115 | 
            -
             | 
| 116 | 
            -
                  it "should allow multiple options to be given" do
         | 
| 117 | 
            -
                    matcher = builder do |m|
         | 
| 118 | 
            -
                      m.bands(:incubus, :foo_fighters)
         | 
| 119 | 
            -
                    end
         | 
| 120 | 
            -
             | 
| 121 | 
            -
                    matcher.options[:bands].should == [:incubus, :foo_fighters]
         | 
| 122 | 
            -
                  end
         | 
| 123 | 
            -
             | 
| 124 | 
            -
                  it "should allow multiple options to be appended once at a time" do
         | 
| 125 | 
            -
                    matcher = builder do |m|
         | 
| 126 | 
            -
                      m.bands(:incubus)
         | 
| 127 | 
            -
                      m.bands(:foo_fighters)
         | 
| 128 | 
            -
                    end
         | 
| 129 | 
            -
             | 
| 130 | 
            -
                    matcher.options[:bands].should == [:incubus, :foo_fighters]
         | 
| 131 | 
            -
                  end
         | 
| 132 | 
            -
             | 
| 133 | 
            -
                  it "should allow blocks to given to options" do
         | 
| 134 | 
            -
                    matcher = builder do |m|
         | 
| 135 | 
            -
                      m.builder {|i| i + 10 }
         | 
| 136 | 
            -
                    end
         | 
| 137 | 
            -
             | 
| 138 | 
            -
                    matcher.options[:builder].call(10).should == 20
         | 
| 139 | 
            -
             | 
| 140 | 
            -
                    matcher = builder do |m|
         | 
| 141 | 
            -
                      m.builder proc {|i| i + 20 }
         | 
| 142 | 
            -
                    end
         | 
| 143 | 
            -
             | 
| 144 | 
            -
                    matcher.options[:builder].call(10).should == 30
         | 
| 145 | 
            -
                  end
         | 
| 146 | 
            -
                end
         | 
| 147 | 
            -
             | 
| 148 | 
            -
                describe "as optionals=" do
         | 
| 115 | 
            +
                  end
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                  it "should allow multiple options to be given" do
         | 
| 118 | 
            +
                    matcher = builder do |m|
         | 
| 119 | 
            +
                      m.bands(:incubus, :foo_fighters)
         | 
| 120 | 
            +
                    end
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                    matcher.options[:bands].should == [:incubus, :foo_fighters]
         | 
| 123 | 
            +
                  end
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                  it "should allow multiple options to be appended once at a time" do
         | 
| 126 | 
            +
                    matcher = builder do |m|
         | 
| 127 | 
            +
                      m.bands(:incubus)
         | 
| 128 | 
            +
                      m.bands(:foo_fighters)
         | 
| 129 | 
            +
                    end
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                    matcher.options[:bands].should == [:incubus, :foo_fighters]
         | 
| 132 | 
            +
                  end
         | 
| 133 | 
            +
             | 
| 134 | 
            +
                  it "should allow blocks to given to options" do
         | 
| 135 | 
            +
                    matcher = builder do |m|
         | 
| 136 | 
            +
                      m.builder {|i| i + 10 }
         | 
| 137 | 
            +
                    end
         | 
| 138 | 
            +
             | 
| 139 | 
            +
                    matcher.options[:builder].call(10).should == 20
         | 
| 140 | 
            +
             | 
| 141 | 
            +
                    matcher = builder do |m|
         | 
| 142 | 
            +
                      m.builder proc {|i| i + 20 }
         | 
| 143 | 
            +
                    end
         | 
| 144 | 
            +
             | 
| 145 | 
            +
                    matcher.options[:builder].call(10).should == 30
         | 
| 146 | 
            +
                  end
         | 
| 147 | 
            +
                end
         | 
| 148 | 
            +
             | 
| 149 | 
            +
                describe "as optionals=" do
         | 
| 149 150 | 
             
                  it "should allow optionals to be set" do
         | 
| 150 | 
            -
                    matcher = builder do |m|
         | 
| 151 | 
            -
                      m.first_name = 'José'
         | 
| 152 | 
            -
                      m.last_name = 'Valim'
         | 
| 151 | 
            +
                    matcher = builder do |m|
         | 
| 152 | 
            +
                      m.first_name = 'José'
         | 
| 153 | 
            +
                      m.last_name = 'Valim'
         | 
| 153 154 | 
             
                    end
         | 
| 154 | 
            -
             | 
| 155 | 
            +
             | 
| 155 156 | 
             
                    matcher.options[:first_name].should == 'José'
         | 
| 156 157 | 
             
                    matcher.options[:last_name].should == 'Valim'
         | 
| 157 | 
            -
                  end
         | 
| 158 | 
            -
             | 
| 158 | 
            +
                  end
         | 
| 159 | 
            +
             | 
| 159 160 | 
             
                  it "should allow alias to be set" do
         | 
| 160 | 
            -
                    matcher = builder do |m|
         | 
| 161 | 
            -
                      m.family_name = 'Valim'
         | 
| 162 | 
            -
                    end
         | 
| 161 | 
            +
                    matcher = builder do |m|
         | 
| 162 | 
            +
                      m.family_name = 'Valim'
         | 
| 163 | 
            +
                    end
         | 
| 163 164 |  | 
| 164 165 | 
             
                    matcher.options[:last_name].should == 'Valim'
         | 
| 165 | 
            -
                  end
         | 
| 166 | 
            -
             | 
| 167 | 
            -
                  it "should allow multiple options to be given" do
         | 
| 168 | 
            -
                    matcher = builder do |m|
         | 
| 169 | 
            -
                      m.bands = [ :incubus, :foo_fighters ]
         | 
| 170 | 
            -
                    end
         | 
| 171 | 
            -
             | 
| 172 | 
            -
                    matcher.options[:bands].should == [ :incubus, :foo_fighters ]
         | 
| 173 | 
            -
                  end
         | 
| 174 | 
            -
             | 
| 175 | 
            -
                  it "should overwrite previous options" do
         | 
| 176 | 
            -
                    matcher = builder do |m|
         | 
| 177 | 
            -
                      m.bands = [ :incubus ]
         | 
| 178 | 
            -
                      m.bands = [ :foo_fighters ]
         | 
| 179 | 
            -
                    end
         | 
| 180 | 
            -
             | 
| 181 | 
            -
                    matcher.options[:bands].should == [ :foo_fighters ]
         | 
| 182 | 
            -
                  end
         | 
| 183 | 
            -
             | 
| 184 | 
            -
                  it "should allow blocks to given to options" do
         | 
| 185 | 
            -
                    matcher = builder do |m|
         | 
| 186 | 
            -
                      m.builder = proc {|i| i + 20 }
         | 
| 187 | 
            -
                    end
         | 
| 188 | 
            -
             | 
| 189 | 
            -
                    matcher.options[:builder].call(10).should == 30
         | 
| 190 | 
            -
                  end
         | 
| 191 | 
            -
                end
         | 
| 192 | 
            -
             | 
| 166 | 
            +
                  end
         | 
| 167 | 
            +
             | 
| 168 | 
            +
                  it "should allow multiple options to be given" do
         | 
| 169 | 
            +
                    matcher = builder do |m|
         | 
| 170 | 
            +
                      m.bands = [ :incubus, :foo_fighters ]
         | 
| 171 | 
            +
                    end
         | 
| 172 | 
            +
             | 
| 173 | 
            +
                    matcher.options[:bands].should == [ :incubus, :foo_fighters ]
         | 
| 174 | 
            +
                  end
         | 
| 175 | 
            +
             | 
| 176 | 
            +
                  it "should overwrite previous options" do
         | 
| 177 | 
            +
                    matcher = builder do |m|
         | 
| 178 | 
            +
                      m.bands = [ :incubus ]
         | 
| 179 | 
            +
                      m.bands = [ :foo_fighters ]
         | 
| 180 | 
            +
                    end
         | 
| 181 | 
            +
             | 
| 182 | 
            +
                    matcher.options[:bands].should == [ :foo_fighters ]
         | 
| 183 | 
            +
                  end
         | 
| 184 | 
            +
             | 
| 185 | 
            +
                  it "should allow blocks to given to options" do
         | 
| 186 | 
            +
                    matcher = builder do |m|
         | 
| 187 | 
            +
                      m.builder = proc {|i| i + 20 }
         | 
| 188 | 
            +
                    end
         | 
| 189 | 
            +
             | 
| 190 | 
            +
                    matcher.options[:builder].call(10).should == 30
         | 
| 191 | 
            +
                  end
         | 
| 192 | 
            +
                end
         | 
| 193 | 
            +
             | 
| 193 194 | 
             
              end
         | 
| 194 | 
            -
             | 
| 195 | 
            +
             | 
| 195 196 | 
             
              describe "description" do
         | 
| 196 197 | 
             
                it "should provide a description with optionals" do
         | 
| 197 198 | 
             
                  matcher = Remarkable::Specs::Matchers::SingleContainMatcher.new(1)
         | 
| @@ -207,21 +208,21 @@ describe Remarkable::DSL::Optionals do | |
| 207 208 | 
             
                  matcher.description.should == 'contain 1 allowing nil and with blank equal true'
         | 
| 208 209 |  | 
| 209 210 | 
             
                  matcher.allow_nil(false)
         | 
| 210 | 
            -
                  matcher.description.should == 'contain 1 not allowing nil and with blank equal true'
         | 
| 211 | 
            -
                end
         | 
| 212 | 
            -
             | 
| 213 | 
            -
                it "should provide a sentence interpolation option to optionals" do
         | 
| 214 | 
            -
                  matcher = Remarkable::Specs::Matchers::SingleContainMatcher.new(1)
         | 
| 211 | 
            +
                  matcher.description.should == 'contain 1 not allowing nil and with blank equal true'
         | 
| 212 | 
            +
                end
         | 
| 213 | 
            +
             | 
| 214 | 
            +
                it "should provide a sentence interpolation option to optionals" do
         | 
| 215 | 
            +
                  matcher = Remarkable::Specs::Matchers::SingleContainMatcher.new(1)
         | 
| 215 216 | 
             
                  matcher.values(1, 2, 3)
         | 
| 216 | 
            -
                  matcher.description.should == 'contain 1 not checking for blank and values equal to 1, 2, and 3'
         | 
| 217 | 
            -
                end
         | 
| 218 | 
            -
             | 
| 219 | 
            -
                it "should inspect values in sentence interpolation options" do
         | 
| 220 | 
            -
                  matcher = Remarkable::Specs::Matchers::SingleContainMatcher.new(1)
         | 
| 217 | 
            +
                  matcher.description.should == 'contain 1 not checking for blank and values equal to 1, 2, and 3'
         | 
| 218 | 
            +
                end
         | 
| 219 | 
            +
             | 
| 220 | 
            +
                it "should inspect values in sentence interpolation options" do
         | 
| 221 | 
            +
                  matcher = Remarkable::Specs::Matchers::SingleContainMatcher.new(1)
         | 
| 221 222 | 
             
                  matcher.values(:a, :b, :c)
         | 
| 222 | 
            -
                  matcher.description.should == 'contain 1 not checking for blank and values equal to :a, :b, and :c'
         | 
| 223 | 
            -
                end
         | 
| 224 | 
            -
             | 
| 223 | 
            +
                  matcher.description.should == 'contain 1 not checking for blank and values equal to :a, :b, and :c'
         | 
| 224 | 
            +
                end
         | 
| 225 | 
            +
             | 
| 225 226 | 
             
                it "should provide a description with optionals through namespace lookup" do
         | 
| 226 227 | 
             
                  matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1)
         | 
| 227 228 | 
             
                  matcher.description.should == 'contain 1'
         | 
| @@ -231,6 +232,6 @@ describe Remarkable::DSL::Optionals do | |
| 231 232 |  | 
| 232 233 | 
             
                  matcher.allow_nil(false)
         | 
| 233 234 | 
             
                  matcher.description.should == 'contain 1 not allowing nil'
         | 
| 234 | 
            -
                end
         | 
| 235 | 
            +
                end
         | 
| 235 236 | 
             
              end
         | 
| 236 237 | 
             
            end
         | 
    
        data/spec/messages_spec.rb
    CHANGED
    
    
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: remarkable
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 3.1. | 
| 4 | 
            +
              version: 3.1.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Carlos Brando
         | 
| @@ -10,7 +10,7 @@ autorequire: | |
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 12 |  | 
| 13 | 
            -
            date: 2009-05- | 
| 13 | 
            +
            date: 2009-05-28 00:00:00 +02:00
         | 
| 14 14 | 
             
            default_executable: 
         | 
| 15 15 | 
             
            dependencies: 
         | 
| 16 16 | 
             
            - !ruby/object:Gem::Dependency 
         |