Fix codestyle of announcement controller spec
This commit is contained in:
parent
a28f581aed
commit
c2b448ae8c
|
@ -24,7 +24,7 @@ describe AnnouncementController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "one announcement" do
|
context "one announcement" do
|
||||||
let!(:announcement) { Announcement.create(content: "I am announcement", user: user, starts_at: Time.current, ends_at: Time.current + 2.days) }
|
let!(:announcement) { Announcement.create(content: "I am announcement", user: user, starts_at: Time.current, ends_at: 2.days.from_now) }
|
||||||
|
|
||||||
it "includes the announcement in the @announcements assign" do
|
it "includes the announcement in the @announcements assign" do
|
||||||
subject
|
subject
|
||||||
|
@ -51,9 +51,9 @@ describe AnnouncementController, type: :controller do
|
||||||
let :announcement_params do
|
let :announcement_params do
|
||||||
{
|
{
|
||||||
announcement: {
|
announcement: {
|
||||||
content: "I like dogs!",
|
content: "I like dogs!",
|
||||||
starts_at: Time.current,
|
starts_at: Time.current,
|
||||||
ends_at: Time.current + 2.days
|
ends_at: 2.days.from_now
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -79,9 +79,9 @@ describe AnnouncementController, type: :controller do
|
||||||
let :announcement_params do
|
let :announcement_params do
|
||||||
{
|
{
|
||||||
announcement: {
|
announcement: {
|
||||||
content: "I like dogs!",
|
content: "I like dogs!",
|
||||||
starts_at: Time.current,
|
starts_at: Time.current,
|
||||||
ends_at: Time.current - 2.days
|
ends_at: 2.days.ago
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -95,10 +95,10 @@ describe AnnouncementController, type: :controller do
|
||||||
|
|
||||||
describe "#edit" do
|
describe "#edit" do
|
||||||
let! :announcement do
|
let! :announcement do
|
||||||
Announcement.create(content: "Dogs are pretty cool, I guess",
|
Announcement.create(content: "Dogs are pretty cool, I guess",
|
||||||
starts_at: Time.current + 3.days,
|
starts_at: 3.days.from_now,
|
||||||
ends_at: Time.current + 10.days,
|
ends_at: 10.days.from_now,
|
||||||
user: user)
|
user: user)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { get :edit, params: { id: announcement.id } }
|
subject { get :edit, params: { id: announcement.id } }
|
||||||
|
@ -121,15 +121,15 @@ describe AnnouncementController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
let! :announcement do
|
let! :announcement do
|
||||||
Announcement.create(content: "Dogs are pretty cool, I guess",
|
Announcement.create(content: "Dogs are pretty cool, I guess",
|
||||||
starts_at: Time.current + 3.days,
|
starts_at: 3.days.from_now,
|
||||||
ends_at: Time.current + 10.days,
|
ends_at: 10.days.from_now,
|
||||||
user: user)
|
user: user)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
patch :update, params: {
|
patch :update, params: {
|
||||||
id: announcement.id,
|
id: announcement.id,
|
||||||
announcement: announcement_params
|
announcement: announcement_params
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -154,15 +154,15 @@ describe AnnouncementController, type: :controller do
|
||||||
|
|
||||||
let :announcement_params do
|
let :announcement_params do
|
||||||
{
|
{
|
||||||
content: "I like dogs!",
|
content: "I like dogs!",
|
||||||
starts_at: Time.current,
|
starts_at: Time.current,
|
||||||
ends_at: Time.current - 2.days
|
ends_at: 2.days.ago
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
patch :update, params: {
|
patch :update, params: {
|
||||||
id: announcement.id,
|
id: announcement.id,
|
||||||
announcement: announcement_params
|
announcement: announcement_params
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -176,10 +176,10 @@ describe AnnouncementController, type: :controller do
|
||||||
|
|
||||||
describe "#destroy" do
|
describe "#destroy" do
|
||||||
let! :announcement do
|
let! :announcement do
|
||||||
Announcement.create(content: "Dogs are pretty cool, I guess",
|
Announcement.create(content: "Dogs are pretty cool, I guess",
|
||||||
starts_at: Time.current + 3.days,
|
starts_at: 3.days.from_now,
|
||||||
ends_at: Time.current + 10.days,
|
ends_at: 10.days.from_now,
|
||||||
user: user)
|
user: user)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { delete :destroy, params: { id: announcement.id } }
|
subject { delete :destroy, params: { id: announcement.id } }
|
||||||
|
@ -198,4 +198,3 @@ describe AnnouncementController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue