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.51.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.50.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.49.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.48.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.45.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.44.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.43.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.42.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.41.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.40.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.39.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.38.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.37.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.36.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.35.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.34.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.33.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.32.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.31.pre spec/models/cmor/testimonials/testimonial_spec.rb
cmor_testimonials-0.0.30.pre spec/models/cmor/testimonials/testimonial_spec.rb