Sha256: 1066a8013dae315a5db1990dabe0c8ef0dddc353e50df227656b81c37b628829

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

describe 'word_for' do
  
  before(:each) do
    WhowishWord.words = {}
  end
  
  
  it "no variables, no entry" do
    
    value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en")
    value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)#{WhowishWord::SEPARATOR}id(en)"
    
  end
  
  
  it "with variables, no entry" do
    
    value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en", :number=>5, :name=>"tanin")
    value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)|number,name#{WhowishWord::SEPARATOR}id(en){number,name}"
    
  end
  
  
  it "no variables, with entry" do
    
    WhowishWord.words = {"namespace:id(en)" => "hello"}
    value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en")
    value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)#{WhowishWord::SEPARATOR}hello"
    
  end
  
  
  it "with variables, with entry" do
    
    WhowishWord.words = {"namespace:id(en)" => "hello {name} for {number} times"}
    value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en", :number=>5, :name=>"tanin")
    value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)|number,name#{WhowishWord::SEPARATOR}hello tanin for 5 times"
    
  end
  
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whowish_word-0.3.1 spec/unit/word_for_attr_in_edit_mode_spec.rb
whowish_word-0.3.0 spec/unit/word_for_attr_in_edit_mode_spec.rb