Class: Spec::FactoryGirl::Matchers::BeBuiltByFactory

Inherits:
Base
  • Object
show all
Defined in:
lib/spec/factory_girl/matchers/be_built_by_factory.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Spec::FactoryGirl::Matchers::Base

Instance Method Details

#descriptionObject



5
6
7
# File 'lib/spec/factory_girl/matchers/be_built_by_factory.rb', line 5

def description
  "build instance of '#{@target}' by factory '#{@factory}'"
end

#failure_message_for_shouldObject



17
18
19
# File 'lib/spec/factory_girl/matchers/be_built_by_factory.rb', line 17

def failure_message_for_should
  "expected #{@target.inspect} to be build by factory '#{@factory}'\n" + @errors.join("\n")
end

#failure_message_for_should_notObject



21
22
23
# File 'lib/spec/factory_girl/matchers/be_built_by_factory.rb', line 21

def failure_message_for_should_not
  "expected #{@target.inspect} not to be build by factory '#{@factory}'"
end

#matches?(target) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
# File 'lib/spec/factory_girl/matchers/be_built_by_factory.rb', line 9

def matches?(target)
  prepare_matches(target)
  
  @result = Factory.build(@factory)
  
  super
end