Sha256: 7486911cf5e728fd9950f83e5edbb3d2fb3bf2356801a1890de2e28775ea443a

Contents?: true

Size: 713 Bytes

Versions: 16

Compression:

Stored size: 713 Bytes

Contents

class RSpecRemote
  def self.run_describe_block(describe_block)
    temp_path = nil
    Tempfile.open(['example', '_spec.rb']) do |io|
      io.write(<<-spec)
        require 'spec_helper';
        #{describe_block}
      spec
      temp_path = io.path
    end
    `rake SPEC=#{temp_path} 2>&1`
  end
end


RSpecCandy::Switcher.define_matcher :pass_as_describe_block do

  match do |describe_block|
    rspec_out = RSpecRemote.run_describe_block(describe_block)
    rspec_out.include?('0 failures')
  end

end

RSpecCandy::Switcher.define_matcher :fail_as_describe_block do

  match do |describe_block|
    rspec_out = RSpecRemote.run_describe_block(describe_block)
    rspec_out.include?('1 failure')
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rspec_candy-0.3.1 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.3.0 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.10 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.9 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.8 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.7 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.6 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.5 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.4 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.3 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.2 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.1 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.2.0 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.1.2 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.1.1 spec/shared/support/matchers/pass_as_describe_block.rb
rspec_candy-0.1.0 spec/shared/support/matchers/pass_as_describe_block.rb