Sha256: 858b64ae1bb9ab9b0b337ef89e7ca31e2339c9276711515f6b02e4aae0daa6fe

Contents?: true

Size: 635 Bytes

Versions: 3

Compression:

Stored size: 635 Bytes

Contents

require 'rails_helper'

RSpec.describe Attachy::Viewer, '.nodes' do
  let!(:object) { create :user }
  let!(:method) { :photos }
  let(:file_1)  { create :file, attachable: object, scope: method }
  let(:file_2)  { create :file, attachable: object, scope: method }

  before do
    allow(Cloudinary::Uploader).to receive(:remove_tag)

    allow(subject).to receive(:node).with(file_1) { :node_1 }
    allow(subject).to receive(:node).with(file_2) { :node_2 }
  end

  subject { described_class.new method, object }

  it 'returns the nodes with links inside as an array' do
    expect(subject.nodes).to eq [:node_1, :node_2]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
attachy-0.1.2 spec/models/attachy/viewer/nodes_spec.rb
attachy-0.1.1 spec/models/attachy/viewer/nodes_spec.rb
attachy-0.1.0 spec/models/attachy/viewer/nodes_spec.rb