Created
February 2, 2009 18:20
-
-
Save ohammersmith/57022 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {:country=>"United States", :state=>"Delaware", :keyword_filters_attributes=>{"new_1"=>{:any=>true, :keywords=>"Lorem ipsum dolor sit amet,", :must_have=>false, :weight=>4}, "new_2"=>{:any=>true, :keywords=>"Lorem ipsum dolor sit amet,", :must_have=>false, :weight=>8}}, :city=>"Rotorua", :range=>nil, :postal_code=>"03887"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # normalized_nested_attributes branch tests, these will fail when I switch rails off to another branch | |
| it "should let me create a new Criterion with Filters already in the attributes hash" do | |
| @criterion_count = Criterion.count | |
| @filter_count = Filter.count | |
| @keyword_filter_count = KeywordFilter.count | |
| @criterion_attrs = Factory.attributes_for(:criterion) | |
| @criterion_attrs[:keyword_filters_attributes] = {} | |
| # note the keys new_1, new_2 do actually matter. Presumably that's how it knows which ones are new vs existing. | |
| @criterion_attrs[:keyword_filters_attributes]["new_1"] = Factory.attributes_for(:keyword_filter) | |
| @criterion_attrs[:keyword_filters_attributes]["new_2"] = Factory.attributes_for(:keyword_filter) | |
| @criterion = Criterion.create(@criterion_attrs) | |
| Criterion.count.should == @criterion_count + 1 | |
| Filter.count.should == @filter_count + 2 | |
| KeywordFilter.count.should == @keyword_filter_count + 2 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment