Sha256: 6558fabb11d2df716b0db537041fae94b5477e0acefac116d3ff0875e05aef2e

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 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.1 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.3.0 spec/unit/word_for_in_edit_mode_spec.rb