OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
# frozen_string_literal: true
require "spec_helper"
RSpec.describe AnnouncementsController do
let(:announcement) { build(:announcement) }
before do
allow(controller).to receive(:check_if_login_required)
expect(controller).to receive(:require_admin)
allow(Announcement).to receive(:only_one).and_return(announcement)
end
describe "#edit" do
before do
get :edit
end
it do
expect(assigns(:announcement)).to eql announcement
end
it { expect(response).to be_successful }
end
describe "#update" do
before do
expect(announcement).to receive(:save).and_call_original
put :update,
params: {
announcement: {
until_date: "2011-01-11",
text: "announcement!!!",
active: 1
}
}
end
it "edits the announcement" do
expect(response).to redirect_to action: :edit
expect(controller).to set_flash[:notice].to I18n.t(:notice_successful_update)
end
end
end