We're not adding the rule because it would apply the current line length rule of 110 characters per line. We still haven't decided whether we'll keep that rule or make lines shorter so they're easier to read, particularly when vertically splitting the editor window. So, for now, I'm applying the rule to lines which are about 90 characters long.
42 lines
1.3 KiB
Ruby
42 lines
1.3 KiB
Ruby
require "rails_helper"
|
|
|
|
describe Administrator do
|
|
describe "#description_or_name" do
|
|
let!(:user) { create(:user, username: "Billy Wilder") }
|
|
|
|
it "returns description if present" do
|
|
administrator = create(:administrator, user: user, description: "John Doe")
|
|
|
|
expect(administrator.description_or_name).to eq("John Doe")
|
|
end
|
|
|
|
it "returns name if description is nil" do
|
|
administrator = create(:administrator, user: user)
|
|
|
|
expect(administrator.description_or_name).to eq("Billy Wilder")
|
|
end
|
|
|
|
it "returns name if description is blank" do
|
|
administrator = create(:administrator, description: "")
|
|
|
|
expect(administrator.description_or_name).to eq(administrator.name)
|
|
end
|
|
end
|
|
|
|
describe "#description_or_name_and_email" do
|
|
let!(:user) { create(:user, username: "Billy Wilder", email: "test@test.com") }
|
|
|
|
it "returns description and email if decription present" do
|
|
administrator = create(:administrator, description: "John Doe", user: user)
|
|
|
|
expect(administrator.description_or_name_and_email).to eq("John Doe (test@test.com)")
|
|
end
|
|
|
|
it "returns name and email if description is not present" do
|
|
administrator = create(:administrator, user: user)
|
|
|
|
expect(administrator.description_or_name_and_email).to eq("Billy Wilder (test@test.com)")
|
|
end
|
|
end
|
|
end
|