Sha256: b102f639341f359cb3e4a65353254d747181004a9a4d6e019b5cdf1b855b4078

Contents?: true

Size: 845 Bytes

Versions: 17

Compression:

Stored size: 845 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 "/alchemy/pictures/#{picture.id}/show/image.png"
      page.status_code.should == 400
    end

  end

  context "passing correct security token" do

    before do
      visit "/alchemy/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

17 entries across 17 versions & 1 rubygems

Version Path
alchemy_cms-2.5.3.1 spec/integration/picture_security_spec.rb
alchemy_cms-2.5.3 spec/integration/picture_security_spec.rb
alchemy_cms-2.5.2.2 spec/integration/picture_security_spec.rb
alchemy_cms-2.5.2.1 spec/integration/picture_security_spec.rb
alchemy_cms-2.5.2 spec/integration/picture_security_spec.rb
alchemy_cms-2.5.1 spec/integration/picture_security_spec.rb
alchemy_cms-2.5.0 spec/integration/picture_security_spec.rb
alchemy_cms-2.5.0.rc3 spec/integration/picture_security_spec.rb
alchemy_cms-2.5.0.b9 spec/integration/picture_security_spec.rb
alchemy_cms-2.4.1 spec/integration/picture_security_spec.rb
alchemy_cms-2.5.0.b5 spec/integration/picture_security_spec.rb
alchemy_cms-2.5.0.b2 spec/integration/picture_security_spec.rb
alchemy_cms-2.4.0 spec/integration/picture_security_spec.rb
alchemy_cms-2.4.rc4 spec/integration/picture_security_spec.rb
alchemy_cms-2.4.rc2 spec/integration/picture_security_spec.rb
alchemy_cms-2.4.rc1 spec/integration/picture_security_spec.rb
alchemy_cms-2.4.beta2 spec/integration/picture_security_spec.rb