Sha256: 18eeb5b0d46ef8c3f9a6bd29e7c8b323f807ca4eb1b1198de285ec00a2a4c101

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe WhowishWordController do
  
  it "adds a word correctly" do
    
    word_id = "some_controller/some_view.html.erb:some_word(en)"
    content = "Hello"
    
    post :change_word, {
                          :word_id => word_id,
                          :content => content
                        }
                        
    body = expect_json_response    
    body['ok'].should be_true
    
    commit_database
    
    word = WhowishWordHtml.first(:conditions=>{:word_id=>word_id})
    word.content.should == content
    
    WhowishWord.words[word_id].should == content
    WhowishWord.words.length.should == 1
    
  end
  
  it "changes a word correctly" do
    
    word_id = "some_controller/some_view.html.erb:some_word(en)"
    content = "Hello"
    
    WhowishWord.add_or_set_word(word_id, content)
    WhowishWordHtml.create(:word_id=>word_id, :content=>content)
    
    new_content = "Yo!"
    
    post :change_word, {
                          :word_id => word_id,
                          :content => new_content
                        }
                        
    body = expect_json_response    
    body['ok'].should be_true
    
    commit_database
    
    word = WhowishWordHtml.first(:conditions=>{:word_id=>word_id})
    word.content.should == new_content
    
    WhowishWord.words[word_id].should == new_content
    WhowishWord.words.length.should == 1
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whowish_word-0.3.3 rails/spec/controllers/whowish_word_controller_spec.rb
whowish_word-0.3.2 rails/spec/controllers/whowish_word_controller_spec.rb