lib/rspec/expect_it/helpers.rb in rspec-expect_it-1.0.2 vs lib/rspec/expect_it/helpers.rb in rspec-expect_it-1.1.0

- old
+ new

@@ -11,10 +11,18 @@ def expect_it! expect(subject) end + def expect_its(method) + ExpectItsExpectationTarget.new(self, method) + end + + def expect_its!(method) + expect(subject.send(method)) + end + def expect_it_safe if block_given? safe_lambda = lambda do begin self.subject @@ -68,9 +76,24 @@ begin subject || context.subject rescue Exception nil end + end + end + + class ExpectItsExpectationTarget < ExpectItExpectationTarget + attr_accessor :method + + def initialize(context, method) + super(context) + self.method = method + end + + private + + def get_subject + context.subject.send(method) end end end end end \ No newline at end of file