Sha256: 026a1e438feeea4f6a88155ad104d46eafbc8039d11d07e62f0d3a8f52f059a4
Contents?: true
Size: 1.85 KB
Versions: 1
Compression:
Stored size: 1.85 KB
Contents
# frozen_string_literal: true require "rails_helper" RSpec.describe "Backend - Assets (HTML)", type: :feature do def fill_in_asset_form_with(file_name = "", file = "") fill_in "File Name", with: file_name attach_file "File", file if file.present? end describe "creation" do before { stub_authorization! } describe "successful" do it "returns success message with valid data" do visit "/backend/assets/new" fill_in_asset_form_with("amazing.jpg", uploader_test_image) click_button "Create Asset" expect(page).to have_content("Asset was successfully created.") end end describe "unsuccessful" do it "fails without file_name" do visit "/backend/assets/new" fill_in_asset_form_with("", uploader_test_image) click_button "Create Asset" expect(page.find(".form-group.asset_file_name")) .to have_content("File Name can't be blank") end it "fails without file" do visit "/backend/assets/new" fill_in_asset_form_with("amazing.jpg", "") click_button "Create Asset" expect(page.find(".form-group.asset_file")) .to have_content("File can't be blank") end it "fails with invalid file_name" do visit "/backend/assets/new" fill_in_asset_form_with("amazing", uploader_test_image) click_button "Create Asset" expect(page.find(".form-group.asset_file_name")) .to have_content("File Name must be valid file name") end it "fails with invalid file type" do visit "/backend/assets/new" fill_in_asset_form_with("amazing.jpg", uploader_test_stylesheet) click_button "Create Asset" expect(page.find(".form-group.asset_file")) .to have_content("You are not allowed to upload \"css\" files") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
archangel-0.4.0 | spec/features/backend/assets/create_spec.rb |