Sha256: a2dd4b139dc28d5e5878625455939576dde7cdec67a25e12e05c313d50f1f69a

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 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_in_edit_mode("namespace", "id", "en")
    value.should == "<dfn>#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)#{WhowishWord::SEPARATOR}id(en)</dfn>"
    
  end
  
  
  it "with variables, no entry" do
    
    value = WhowishWord.word_for_in_edit_mode("namespace", "id", "en", :number=>5, :name=>"tanin")
    value.should == "<dfn>#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)|number,name#{WhowishWord::SEPARATOR}id(en){number,name}</dfn>"
    
  end
  
  
  it "no variables, with entry" do
    
    WhowishWord.words = {"namespace:id(en)" => "hello"}
    value = WhowishWord.word_for_in_edit_mode("namespace", "id", "en")
    value.should == "<dfn>#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)#{WhowishWord::SEPARATOR}hello</dfn>"
    
  end
  
  
  it "with variables, with entry" do
    
    WhowishWord.words = {"namespace:id(en)" => "hello {name} for {number} times"}
    value = WhowishWord.word_for_in_edit_mode("namespace", "id", "en", :number=>5, :name=>"tanin")
    value.should == "<dfn>#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)|number,name#{WhowishWord::SEPARATOR}hello tanin for 5 times</dfn>"
    
  end
  
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whowish_word-0.3.3 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.3.2 spec/unit/word_for_in_edit_mode_spec.rb