Sha256: cd50e33c0c3e3a4ebe5a32f003a18778c5c823ccacc4cea1348957d1e95c8310
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
require 'rails_helper' RSpec.describe Attachy::Viewer, '.remove_button' do let!(:object) { create :user } let!(:method) { :avatar } let!(:file) do allow(Cloudinary::Uploader).to receive(:remove_tag) create :file, attachable: object, scope: method end subject { described_class.new method, object } context 'when give no html options' do it 'returns just the default options' do el = subject.remove_button expect(el).to have_tag :span, with: { class: 'attachy__remove' } do with_text '×' end end end context 'when give html options' do let!(:html) { { attribute: :value } } it 'merges with default options' do el = subject.remove_button(html: html) expect(el).to have_tag :span, with: { attribute: :value, class: 'attachy__remove' } end end context 'when a block is given' do let!(:html) { { target: :blank } } it 'yields the :html' do subject.remove_button(html: html) do |h| expect(h).to eq(target: :blank, class: :attachy__remove) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
attachy-0.1.2 | spec/models/attachy/viewer/transform_spec.rb |
attachy-0.1.1 | spec/models/attachy/viewer/transform_spec.rb |
attachy-0.1.0 | spec/models/attachy/viewer/transform_spec.rb |