Do you have a field with the name "is_user" on the members table? It seems that method should return a boolean (true or false) while now it's returning a symbol which will always be evaluated to true, as an example, if you do
if :is_user
puts "will always happen" # this will be printed
end
If there is the field on the database, then there's no need to create that method as rails generates methods with question mark for all boolean fields on the model database.
Now, to test that you can use a gem like shoulda_matchers or you can write your own tests like
describe "validations" do
context "member is a user" do
subject { Member.new(is_user: true) }
it "validates presence of email" do
subject.valid?
expect(subject.errors["email"]).to include("can't be blank")
end
end
context "member is not an user" do
subject { Member.new(is_user: false) }
it "doesn't require fields to have info" do
subject.valid?
expect(subject.errors["email"]).to_not include("can't be blank")
expect(subject.errors["first_name"]).to_not include("can't be blank")
expect(subject.errors["last_name"]).to_not include("can't be blank")
end
end
end