Sha256: 4f00a7ba871ffa6222ab78704e1fe71db6f0500a19aa1b896a0df8b065fe6b41

Contents?: true

Size: 829 Bytes

Versions: 15

Compression:

Stored size: 829 Bytes

Contents

require 'spec_helper'

describe 'Picture renderung security', :js => true do

  let(:picture) { Alchemy::Picture.create(:image_file => File.new(File.expand_path('../../support/image.png', __FILE__))) }

  # Prevent the signup view from being rendered.
  before { Alchemy::User.stub!(:count).and_return 1 }

  context "passing no security token" do

    it 'should return a bad request (400)' do
      visit "/pictures/#{picture.id}/show/image.png"
      page.status_code.should == 400
    end

  end

  context "passing correct security token" do

    before do
      visit "/pictures/#{picture.id}/show/image.png?sh=#{picture.security_token}"
    end

    it 'should return image' do
      page.body.should match(/img/)
    end

    it 'should return status ok (200)' do
      page.status_code.should == 200
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
alchemy_cms-2.8.3 spec/features/picture_security_spec.rb
alchemy_cms-2.7.5 spec/features/picture_security_spec.rb
alchemy_cms-2.6.3 spec/features/picture_security_spec.rb
alchemy_cms-2.7.4 spec/features/picture_security_spec.rb
alchemy_cms-2.8.2 spec/features/picture_security_spec.rb
alchemy_cms-2.8.1 spec/features/picture_security_spec.rb
alchemy_cms-2.7.3 spec/features/picture_security_spec.rb
alchemy_cms-2.7.2 spec/features/picture_security_spec.rb
alchemy_cms-2.7.1 spec/features/picture_security_spec.rb
alchemy_cms-2.7.0 spec/features/picture_security_spec.rb
alchemy_cms-2.6.2.1 spec/features/picture_security_spec.rb
alchemy_cms-2.6.2 spec/features/picture_security_spec.rb
alchemy_cms-2.6.1 spec/features/picture_security_spec.rb
alchemy_cms-2.6.0 spec/features/picture_security_spec.rb
alchemy_cms-2.6.0.rc5 spec/features/picture_security_spec.rb