Sha256: 17b149c25eef1d22d6eb204bdc3f4289cfbef7b7470fbcde164f1317ca63479f

Contents?: true

Size: 1.39 KB

Versions: 17

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

17 entries across 17 versions & 1 rubygems

Version Path
whowish_word-0.2.7 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.2.6 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.2.5 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.2.3 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.2.2 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.2.1 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.2.0 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.1.9 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.1.8 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.1.7 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.1.6 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.1.5 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.1.4 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.1.3 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.1.2 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.1.1 spec/unit/word_for_in_edit_mode_spec.rb
whowish_word-0.1.0 spec/unit/word_for_in_edit_mode_spec.rb