Sha256: 5aea13466e68ccfe5a7449fed22342177cee25d49ee5c10657109d871cb7aa01

Contents?: true

Size: 834 Bytes

Versions: 11

Compression:

Stored size: 834 Bytes

Contents

require 'spec_helper'

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

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

  # Prevent the signup view from being rendered.
  before { Alchemy.user_class.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

11 entries across 11 versions & 1 rubygems

Version Path
alchemy_cms-2.9.1 spec/features/picture_security_spec.rb
alchemy_cms-3.0.4 spec/features/picture_security_spec.rb
alchemy_cms-3.0.3 spec/features/picture_security_spec.rb
alchemy_cms-3.0.2 spec/features/picture_security_spec.rb
alchemy_cms-3.0.1 spec/features/picture_security_spec.rb
alchemy_cms-3.0.0 spec/features/picture_security_spec.rb
alchemy_cms-3.0.0.rc8 spec/features/picture_security_spec.rb
alchemy_cms-2.9.0 spec/features/picture_security_spec.rb
alchemy_cms-3.0.0.rc7 spec/features/picture_security_spec.rb
alchemy_cms-3.0.0.rc6 spec/features/picture_security_spec.rb
alchemy_cms-3.0.0.rc5 spec/features/picture_security_spec.rb