Adds imageable to legislation proposals
This commit is contained in:
@@ -54,6 +54,7 @@ class Legislation::ProposalsController < Legislation::BaseController
|
||||
params.require(:legislation_proposal).permit(:legislation_process_id, :title,
|
||||
:question, :summary, :description, :video_url, :tag_list,
|
||||
:terms_of_service, :geozone_id,
|
||||
image_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy],
|
||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id])
|
||||
end
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ class Legislation::Proposal < ActiveRecord::Base
|
||||
include Communitable
|
||||
include Documentable
|
||||
include Notifiable
|
||||
include Imageable
|
||||
|
||||
documentable max_documents_allowed: 3,
|
||||
max_file_size: 3.megabytes,
|
||||
|
||||
@@ -2,6 +2,8 @@ require 'rails_helper'
|
||||
|
||||
feature 'Legislation Proposals' do
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:process) { create(:legislation_process) }
|
||||
let(:proposal) { create(:legislation_proposal) }
|
||||
|
||||
context "Concerns" do
|
||||
@@ -16,4 +18,21 @@ feature 'Legislation Proposals' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Create a legislation proposal with an image", :js do
|
||||
create(:legislation_proposal, process: process)
|
||||
|
||||
login_as user
|
||||
|
||||
visit new_legislation_process_proposal_path(process)
|
||||
|
||||
fill_in 'Proposal title', with: 'Legislation proposal with image'
|
||||
fill_in 'Proposal summary', with: 'Including an image on a legislation proposal'
|
||||
imageable_attach_new_file(create(:image), Rails.root.join('spec/fixtures/files/clippy.jpg'))
|
||||
check 'legislation_proposal_terms_of_service'
|
||||
click_button 'Create proposal'
|
||||
|
||||
expect(page).to have_content 'Legislation proposal with image'
|
||||
expect(page).to have_content 'Including an image on a legislation proposal'
|
||||
expect(page).to have_css("img[alt='#{Legislation::Proposal.last.image.title}']")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user