Sha256: c13270842dc7b3b0eb6ee82aaf5d0a7b75df2f3f3a00b77f59e5b06c7c3e8eb9

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))

describe "DataMapper::NamingConventions" do
  it "should coerce a string into the Underscored convention" do
    DataMapper::NamingConventions::Underscored.call('User').should == 'user'
    DataMapper::NamingConventions::Underscored.call('UserAccountSetting').should == 'user_account_setting'
  end

  it "should coerce a string into the UnderscoredAndPluralized convention" do
    DataMapper::NamingConventions::UnderscoredAndPluralized.call('User').should == 'users'
    DataMapper::NamingConventions::UnderscoredAndPluralized.call('UserAccountSetting').should == 'user_account_settings'
  end

  it "should coerce a string into the UnderscoredAndPluralized convention joining namespace with underscore" do
    DataMapper::NamingConventions::UnderscoredAndPluralized.call('Model::User').should == 'model_users'
    DataMapper::NamingConventions::UnderscoredAndPluralized.call('Model::UserAccountSetting').should == 'model_user_account_settings'
  end

  it "should coerce a string into the  UnderscoredAndPluralizedWithoutModule convention" do
    DataMapper::NamingConventions::UnderscoredAndPluralizedWithoutModule.call('Model::User').should == 'users'
    DataMapper::NamingConventions::UnderscoredAndPluralizedWithoutModule.call('Model::UserAccountSetting').should == 'user_account_settings'
  end

  it "should coerce a string into the Yaml convention" do
    DataMapper::NamingConventions::Yaml.call('UserSetting').should == 'user_settings.yaml'
    DataMapper::NamingConventions::Yaml.call('User').should == 'users.yaml'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-core-0.9.2 spec/unit/naming_conventions_spec.rb
dm-core-0.9.3 spec/unit/naming_conventions_spec.rb