Skip to content

Commit

Permalink
should work with symbols as list names
Browse files Browse the repository at this point in the history
  • Loading branch information
langalex committed May 13, 2011
1 parent 8e7b243 commit 368b6ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/couch_potato/view/base_view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def translate_to_design_doc_name(klass_name, view_name, list_name)
doc_name = klass_name.downcase

if CouchPotato::Config.split_design_documents_per_view
doc_name += "_view_" + view_name if view_name.present?
doc_name += "_list_" + list_name if list_name.present?
doc_name += "_view_#{view_name}" if view_name.present?
doc_name += "_list_#{list_name}" if list_name.present?
end
doc_name
end
Expand Down
14 changes: 7 additions & 7 deletions spec/unit/base_view_spec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,23 @@

it "should generate the design document per view if configured to" do
CouchPotato::Config.split_design_documents_per_view = true
spec = CouchPotato::View::BaseViewSpec.new stub(:lists => nil, :to_s => 'User'), '', {:list => 'test_list'}, {}
spec = CouchPotato::View::BaseViewSpec.new stub(:lists => nil, :to_s => 'User'), '', {:list => :test_list}, {}
spec.design_document.should == 'user_list_test_list'
end

it "should extract the list name from the options" do
spec = CouchPotato::View::BaseViewSpec.new stub(:lists => nil), 'all', {:list => 'test_list'}, {}
spec.list_name.should == 'test_list'
spec = CouchPotato::View::BaseViewSpec.new stub(:lists => nil), 'all', {:list => :test_list}, {}
spec.list_name.should == :test_list
end

it "should extract the list from the view parameters" do
spec = CouchPotato::View::BaseViewSpec.new stub(:lists => nil), 'all', {}, {:list => 'test_list'}
spec.list_name.should == 'test_list'
spec = CouchPotato::View::BaseViewSpec.new stub(:lists => nil), 'all', {}, {:list => :test_list}
spec.list_name.should == :test_list
end

it "should prefer the list name from the view parameters over the one from the options" do
spec = CouchPotato::View::BaseViewSpec.new stub(:lists => nil), 'all', {:list => 'my_list'}, {:list => 'test_list'}
spec.list_name.should == 'test_list'
spec = CouchPotato::View::BaseViewSpec.new stub(:lists => nil), 'all', {:list => 'my_list'}, {:list => :test_list}
spec.list_name.should == :test_list
end

it "should return the list function" do
Expand Down

0 comments on commit 368b6ff

Please sign in to comment.