Module: Spec::Example::ExampleMethods

Defined in:
lib/remarkable/example/example_methods.rb

Instance Method Summary collapse

Instance Method Details

#remarkable_responseObject



33
34
35
# File 'lib/remarkable/example/example_methods.rb', line 33

def remarkable_response
  @remarkable_response ||= self.response if self.respond_to?(:response)
end

#remarkable_subjectObject



28
29
30
31
# File 'lib/remarkable/example/example_methods.rb', line 28

def remarkable_subject
  @remarkable_subject = subject if self.respond_to?(:subject)
  @remarkable_subject ||= self.class.described_type
end

#should(matcher) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/remarkable/example/example_methods.rb', line 4

def should(matcher)
  if rspec_rails_controller_matcher?(matcher)
    remarkable_response.should matcher
  elsif remarkable_matcher?(matcher)
    remarkable_subject.should matcher.spec(self)
  elsif exists_a_rspec_subject?
    subject.should(matcher)
  else
    super
  end
end

#should_not(matcher) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/remarkable/example/example_methods.rb', line 16

def should_not(matcher)
  if rspec_rails_controller_matcher?(matcher)
    remarkable_response.should_not matcher
  elsif remarkable_matcher?(matcher)
    remarkable_subject.should_not matcher.spec(self).negative
  elsif exists_a_rspec_subject?
    subject.should_not(matcher)
  else
    super
  end
end