Sha256: b4dcbaba1c221cd22e4957d09aa31d04d51a7532c7d4a979cc191eedc2440ff8

Contents?: true

Size: 1.03 KB

Versions: 76

Compression:

Stored size: 1.03 KB

Contents

# RSpec matcher to spec delegations.
RSpec::Matchers.define :belong_to_associated_active_fedora_object do |association_name|
  match do |subject|
    @association_name = association_name
    if @association_name.nil? || @expected_object.nil?
      raise(
        ArgumentError,
        "subject.should belong_to_associated_active_fedora_object(<association_name>).with_object(<object>)"
      )
    end

    @subject = subject.class.find(subject.pid)
    @actual_object = @subject.send(@association_name)

    @expected_object == @actual_object
  end

  chain(:with_object) { |object| @expected_object = object }


  description do
    "#{@subject.class} PID=#{@subject.pid} association: #{@association_name.inspect} matches ActiveFedora"
  end

  failure_message_for_should do |text|
    "expected #{@subject.class} PID=#{@subject.pid} association: #{@association_name.inspect} to match"
  end

  failure_message_for_should_not do |text|
    "expected #{@subject.class} PID=#{@subject.pid} association: #{@association_name.inspect} to NOT match"
  end

end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
active-fedora-8.7.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.6.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.5.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.4.2 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.4.1 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-7.3.1 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-7.3.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.4.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.3.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.2.2 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.2.1 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.2.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-7.2.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-6.8.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.1.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.0.1 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.0.0 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.0.0.rc3 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.0.0.rc2 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb
active-fedora-8.0.0.rc1 lib/active_fedora/rspec_matchers/belong_to_associated_active_fedora_object_matcher.rb