Module: ExAequo::RSpex::Helpers::SubjectHelpers

Defined in:
lib/ex_aequo/rspex/helpers/subject_helpers.rb

Instance Method Summary collapse

Instance Method Details

#it_eq(value, &blk) ⇒ Object Also known as: it_equals



8
9
10
11
# File 'lib/ex_aequo/rspex/helpers/subject_helpers.rb', line 8

def it_eq(value, &blk)
  actual = blk ? instance_eval(&blk) : subject
  expect(actual).to eq(value)
end

#it_is(predicate, *args, &blk) ⇒ Object



14
15
16
17
# File 'lib/ex_aequo/rspex/helpers/subject_helpers.rb', line 14

def it_is(predicate, *args, &blk)
  actual = blk ? instance_eval(&blk) : subject
  expect(actual).to send("be_#{predicate}", *args)
end

#it_is_not(predicate, *args, &blk) ⇒ Object



19
20
21
22
# File 'lib/ex_aequo/rspex/helpers/subject_helpers.rb', line 19

def it_is_not(predicate, *args, &blk) 
  actual = blk ? instance_eval(&blk) : subject
  expect(actual).not_to send("be_#{predicate}", *args)
end

#it_raises(exception, message = nil, &blk) ⇒ Object



24
25
26
27
# File 'lib/ex_aequo/rspex/helpers/subject_helpers.rb', line 24

def it_raises(exception, message=nil, &blk)
  expect { blk ? instance_eval(&blk) : subject }
    .to raise_error(exception, message)
end