Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Dynamically created methods return wrong result #24

Open
pfeiffer opened this issue Mar 31, 2011 · 1 comment
Open

Bug: Dynamically created methods return wrong result #24

pfeiffer opened this issue Mar 31, 2011 · 1 comment
Labels

Comments

@pfeiffer
Copy link

There seem to be a problem with the dynamically created methods, when the selected value is a part of one of the other values of the attribute.

A good example is when adding eg. a "sex" enumerated attribute with "female" and "male" values:

class Tractor
   enum_attr :driver_sex, %w(male female)
end

These specs both fail:

it "should not fail like this:" do
    t = Tractor.new
    t.driver_sex = :male
    t.driver_sex_female?.should be_false
end

=> Failure/Error: t.driver_sex_female?.should be_false
       expected true to be false
it "should not fail like this:" do
    t = Tractor.new
    t.driver_sex = :female
    t.driver_sex_female?.should be_true
end

=> Failure/Error: t.driver_sex_female?.should be_true
       expected false to be true
@SebastianEdwards
Copy link

+1 to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants