Sha256: ff109dd4a67a58e0b40f35bb07d86c1297c3a32d796eb6aa28ecb56513fc6f92
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
require 'rails_helper' describe Intro::Admin::ImagesController, type: :controller do routes { Intro::Engine.routes } let(:image) { Rack::Test::UploadedFile.new('spec/fixtures/ruby.png', 'image/png') } context 'unauthorized' do it 'should get unauthorized status' do post :create, format: :json expect(response).to have_http_status(:unauthorized) end end context 'authorized' do before do session[:intro_admin_authenticated] = Intro.config.admin_username_digest end after do session.delete(:intro_admin_authenticated) end context '#create' do it 'should get bad_request without image' do post :create, format: :json expect(response).to have_http_status(:bad_request) end it 'should successfully upload with image' do self.class.fixture_path = File.expand_path('../../fixtures', __FILE__) if self.class.respond_to?(:fixture_path) && !self.class.fixture_path post :create, params: { image: image }, format: :json expect(response.successful?).to be true expect(json_body[:data]).not_to be_nil expect(json_body[:data][:url]).not_to be_nil end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
intro-0.4.1 | spec/controllers/intro_admin_images_controller_spec.rb |