Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.0 KiB
Ruby
Raw Permalink Normal View History

2025-05-05 09:29:55 +02:00
# frozen_string_literal: true
2016-04-28 14:52:05 +02:00
require "spec_helper"
2023-05-31 12:15:15 +02:00
RSpec.describe AnnouncementsController do
let(:announcement) { build(:announcement) }
2016-04-28 14:52:05 +02:00
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
2024-01-04 17:01:17 +01:00
it do
expect(assigns(:announcement)).to eql announcement
end
it { expect(response).to be_successful }
2016-04-28 14:52:05 +02:00
end
describe "#update" do
before do
expect(announcement).to receive(:save).and_call_original
put :update,
2016-10-17 10:21:42 +02:00
params: {
announcement: {
until_date: "2011-01-11",
text: "announcement!!!",
active: 1
}
2016-04-28 14:52:05 +02:00
}
end
it "edits the announcement" do
2016-06-23 10:14:46 +02:00
expect(response).to redirect_to action: :edit
2016-07-22 16:30:22 +02:00
expect(controller).to set_flash[:notice].to I18n.t(:notice_successful_update)
2016-04-28 14:52:05 +02:00
end
end
end