mirror of
https://github.com/opf/openproject.git
synced 2026-06-14 03:30:14 +00:00
0b87e7543f
Rolling out frozen string literals further by freezing all string literals in core specs.
46 lines
1.0 KiB
Ruby
46 lines
1.0 KiB
Ruby
# 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
|