<commit_before>require File.join(File.dirname(__FILE__), '../../spec_helper')

describe ViewModels::Helper::Rails do
  include ViewModels::Helper::Rails
  
  describe "collection_view_model_for" do
    it "should return kind of a ViewModels::Collection" do
      collection_view_model_for([]).should be_kind_of ViewModels::Helper::Rails::Collection
    end
    it "should pass any parameters directly through" do
      collection = stub :collection
      context = stub :context
      ViewModels::Helper::Rails::Collection.should_receive(:new).with(collection, context).once
      collection_view_model_for collection, context
    end
  end
  
  describe "view_model_for" do
    it "should just pass the params through to the view_model" do
      class SomeModelClazz; end
      class ViewModels::SomeModelClazz < ViewModels::Base; end
      context = stub :context
      self.stub! :default_view_model_class_for => ViewModels::SomeModelClazz
      model = SomeModelClazz.new
      
      ViewModels::SomeModelClazz.should_receive(:new).once.with model, context
      
      view_model_for model, context
    end
    describe "specific_view_model_mapping" do
      it "should return an empty hash by default" do
        specific_view_model_mapping.should == {}
      end<commit_msg>! Namespaces<commit_after>require File.join(File.dirname(__FILE__), '../../spec_helper')

describe ViewModels::Helpers::Rails do
  include ViewModels::Helpers::Rails
  
  describe "collection_view_model_for" do
    it "should return kind of a ViewModels::Collection" do
      collection_view_model_for([]).should be_kind_of ViewModels::Helpers::Rails::Collection
    end
    it "should pass any parameters directly through" do
      collection = stub :collection
      context = stub :context
      ViewModels::Helpers::Rails::Collection.should_receive(:new).with(collection, context).once
      collection_view_model_for collection, context
    end
  end
  
  describe "view_model_for" do
    it "should just pass the params through to the view_model" do
      class SomeModelClazz; end
      class ViewModels::SomeModelClazz < ViewModels::Base; end
      context = stub :context
      self.stub! :default_view_model_class_for => ViewModels::SomeModelClazz
      model = SomeModelClazz.new
      
      ViewModels::SomeModelClazz.should_receive(:new).once.with model, context
      
      view_model_for model, context
    end
    describe "specific_view_model_mapping" do
      it "should return an empty hash by default" do
        specific_view_model_mapping.should == {}
      end
{'fraction_non_alphanumeric': 0.08297623685235683, 'fraction_numerical': 0.0, 'mean_word_length': 3.7732342007434942, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1982585', 'n_tokens_mistral': 713, 'n_tokens_neox': 714, 'n_words': 188}