module RSpec::ExpectIt::Helpers

Public Instance Methods

expect_it() click to toggle source
# File lib/rspec/expect_it/helpers.rb, line 4
def expect_it
  if block_given?
    RSpec::ExpectIt::ExpectationTargets::ExpectIt.new(self, lambda { self.subject })
  else
    RSpec::ExpectIt::ExpectationTargets::ExpectIt.new(self)
  end
end
expect_it!() click to toggle source
# File lib/rspec/expect_it/helpers.rb, line 12
def expect_it!
  expect(subject)
end
expect_it_safe() click to toggle source
# File lib/rspec/expect_it/helpers.rb, line 24
def expect_it_safe
  if block_given?
    safe_lambda = lambda do
      begin
        self.subject
      rescue Exception
        nil
      end
    end
    RSpec::ExpectIt::ExpectationTargets::ExpectIt.new(self, safe_lambda)
  else
    raise ArgumentError, "method must be called as expect_it_safe{}"
  end
end
expect_its(method) click to toggle source
# File lib/rspec/expect_it/helpers.rb, line 16
def expect_its(method)
  RSpec::ExpectIt::ExpectationTargets::ExpectIts.new(self, method)
end
expect_its!(method) click to toggle source
# File lib/rspec/expect_it/helpers.rb, line 20
def expect_its!(method)
  expect(subject.send(method))
end