beerlington/classy_enum — Issue #10: 2 tests failing - extra id parameter in AR?
Author: adheerajkumar
Created: 2012-02-11 14:43:39+00:00
State: open

Clone, bundle, rspec. Two tests failed?

There's an id extra. Isn't that how AR should behave? adding id automatically? (I don't know much about AR, so correct me if I'm wrong)

```ruby
bundle exec rspec !352
-- create_table(:dogs, {:force=>true})
-> 0.0137s
-- create_table(:other_dogs, {:force=>true})
-> 0.0006s
-- create_table(:allow_blank_breed_dogs, {:force=>true})
-> 0.0005s
-- create_table(:allow_nil_breed_dogs, {:force=>true})
-> 0.0005s
-- create_table(:active_dogs, {:force=>true})
-> 0.0006s
-- create_table(:cats, {:force=>true})
-> 0.0005s
-- create_table(:other_cats, {:force=>true})
-> 0.0005s
-- initialize_schema_migrations_table()
-> 0.0006s
-- assume_migrated_upto_version(1, ["db/migrate"])
-> 0.0002s
...........................FF.....................................

Failures:

1) Cat should correctly serialize without the owner reference
Failure/Error: abyssian.to_json.should == "{\"cat\":{\"breed\":\"abyssian\"}}"
expected: "{\"cat\":{\"breed\":\"abyssian\"}}"
got: "{\"cat\":{\"breed\":\"abyssian\",\"id\":null}}" (using ==)
# ./spec/classy_enum_owner_reference_spec.rb:34:in `block (2 levels) in '

2) Cat should convert the enum to a string when serializing
Failure/Error: persian.to_json.should == "{\"other_cat\":{\"breed\":{}}}"
expected: "{\"other_cat\":{\"breed\":{}}}"
got: "{\"other_cat\":{\"breed\":{},\"id\":null}}" (using ==)
# ./spec/classy_enum_owner_reference_spec.rb:38:in `block (2 levels) in '

Finished in 0.23622 seconds
66 examples, 2 failures

Failed examples:

rspec ./spec/classy_enum_owner_reference_spec.rb:33 # Cat should correctly serialize without the owner reference
rspec ./spec/classy_enum_owner_reference_spec.rb:37 # Cat should convert the enum to a string when serializing