Sha256: 206fd7c9557e9f1eb7523ee5f2d3e7e39428526084c3dd8b211ec2943452da41

Contents?: true

Size: 956 Bytes

Versions: 41

Compression:

Stored size: 956 Bytes

Contents

require 'rails_helper'

RSpec.describe Cmor::Testimonials::Testimonial, type: :model do
  subject { create :cmor_testimonials_testimonial }

  context "acts as list" do
    it { should respond_to(:move_to_top) }
    it { should respond_to(:move_higher) }
    it { should respond_to(:move_lower) }
    it { should respond_to(:move_to_bottom) }
  end

  context "associations" do
    it { should belong_to :category }
  end

  context "active_storage" do
    it { should respond_to :image }
  end

  describe "attach image" do
    let(:filename) { 'homer.png' } 
    let(:file) { File.open(Cmor::Testimonials::Engine.root.join(*%W(spec files cmor testimonials testimonials #{filename}))) }    
    
    before(:each) do
      subject.image.attach(io: file, filename: filename, content_type: 'image/png')
      subject.save!
    end
    
    it { expect(subject.image).to be_attached }
    it { expect(subject.image.filename.to_s).to eq(filename) }
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
cmor_testimonials-0.0.29.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.28.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.27.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.26.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.25.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.24.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.22.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.21.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.20.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.19.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.18.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.17.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.16.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.15.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.14.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.13.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.12.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.11.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.10.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.9.pre spec/models/cmor/testimonials/testimonial_spec.rb