whowish_word 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/.gitignore +5 -5
  2. data/.loadpath +5 -5
  3. data/.project +18 -17
  4. data/Gemfile +2 -2
  5. data/HOW_TO_BUILD_WHOWISH_HOOK.md +9 -9
  6. data/ISSUE.md +93 -93
  7. data/README.md +208 -208
  8. data/lib/whowish_word/action_controller/base.rb +44 -44
  9. data/lib/whowish_word/action_mailer/base.rb +11 -11
  10. data/lib/whowish_word/action_view/base.rb +70 -70
  11. data/lib/whowish_word/action_view/template.rb +30 -30
  12. data/lib/whowish_word/authentication.rb +13 -13
  13. data/lib/whowish_word/config.rb +21 -21
  14. data/lib/whowish_word/constant.rb +8 -8
  15. data/lib/whowish_word/db_migration/active_record/whowish_word_html.rb +14 -14
  16. data/lib/whowish_word/db_migration/mongoid/whowish_word_html.rb +5 -5
  17. data/lib/whowish_word/initializer.rb +52 -52
  18. data/lib/whowish_word/rails/app/controllers/whowish_word_controller.rb +60 -60
  19. data/lib/whowish_word/rails/app/models/active_record/whowish_word_html.rb +3 -3
  20. data/lib/whowish_word/rails/app/models/mongoid/whowish_word_html.rb +8 -8
  21. data/lib/whowish_word/rails/public/javascripts/0_jquery-1.6.4-whowish_word.js +9046 -9046
  22. data/lib/whowish_word/rails/public/javascripts/1_csrf_token_hook.js +9 -9
  23. data/lib/whowish_word/rails/public/javascripts/1_jquery.loading_button.js +66 -66
  24. data/lib/whowish_word/rails/public/javascripts/2_whowish_word_variables.js +33 -33
  25. data/lib/whowish_word/rails/public/javascripts/3_whowish_word_dialog.js +136 -136
  26. data/lib/whowish_word/rails/public/javascripts/3_whowish_word_helper.js +116 -116
  27. data/lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js +69 -69
  28. data/lib/whowish_word/whowish_word.rb +41 -41
  29. data/lib/whowish_word/word_for.rb +93 -93
  30. data/rails/Gemfile +18 -18
  31. data/rails/Gemfile.lock +63 -64
  32. data/rails/app/controllers/application_controller.rb +22 -22
  33. data/rails/app/controllers/home_controller.rb +8 -8
  34. data/rails/app/views/home/index.html.erb +109 -109
  35. data/rails/app/views/home/static_edit.html.erb +50 -50
  36. data/rails/app/views/home/static_edit_select.html.erb +8 -8
  37. data/rails/app/views/integration/attr.html.erb +1 -1
  38. data/rails/app/views/integration/index.html.erb +1 -1
  39. data/rails/app/views/integration/select.html.erb +3 -3
  40. data/rails/app/views/integration/value.html.erb +1 -1
  41. data/rails/app/views/layouts/integration.html.erb +14 -14
  42. data/rails/app/views/layouts/main.html.erb +13 -13
  43. data/rails/app/views/layouts/nested_test_word_for.html.erb +17 -17
  44. data/rails/app/views/layouts/test_javascript.html.erb +13 -13
  45. data/rails/app/views/layouts/test_word_for.html.erb +24 -24
  46. data/rails/app/views/test_javascript/change_value.html.erb +32 -32
  47. data/rails/app/views/test_javascript/index.html.erb +87 -87
  48. data/rails/app/views/test_javascript/replace_with_html.html.erb +96 -96
  49. data/rails/app/views/test_word_for/_partial.html.erb +4 -4
  50. data/rails/app/views/test_word_for/index.html.erb +8 -8
  51. data/rails/config/application.rb +30 -30
  52. data/rails/config/boot.rb +9 -9
  53. data/rails/config/database.yml +24 -24
  54. data/rails/config/environment.rb +16 -16
  55. data/rails/config/initializers/whowish_word.rb +3 -3
  56. data/rails/config/mongoid.rb +6 -6
  57. data/rails/config/mongoid.yml +14 -14
  58. data/rails/config/routes.rb +7 -7
  59. data/rails/config.ru +4 -4
  60. data/rails/log/.gitignore +1 -1
  61. data/rails/mongo.bat +4 -4
  62. data/rails/public/javascripts/jquery.loading_button.js +72 -72
  63. data/rails/public/test/jquery_version.html +26 -26
  64. data/rails/script/rails +6 -6
  65. data/rails/spec/controllers/whowish_word_controller_spec.rb +55 -55
  66. data/rails/spec/integration/whowish_word_generator_spec.rb +139 -139
  67. data/rails/spec/integration/whowish_word_spec.rb +116 -116
  68. data/rails/spec/spec_helper.rb +34 -36
  69. data/rails/spec/support/browser.rb +193 -193
  70. data/rails/spec/support/json_rspec_helper.rb +8 -8
  71. data/rails/spec/support/mongoid_helper.rb +9 -9
  72. data/spec/spec_helper.rb +17 -19
  73. data/spec/unit/word_for_attr_in_edit_mode_spec.rb +43 -43
  74. data/spec/unit/word_for_attr_spec.rb +43 -43
  75. data/spec/unit/word_for_in_edit_mode_spec.rb +43 -43
  76. data/spec/unit/word_for_spec.rb +43 -43
  77. data/whowish_word.gemspec +21 -21
  78. metadata +73 -4
@@ -1,30 +1,30 @@
1
- $ORM_ENGINE = :active_record
2
- #$ORM_ENGINE = :mongoid
3
-
4
- require File.expand_path('../boot', __FILE__)
5
-
6
- # Pick the frameworks you want:
7
-
8
- require "active_record/railtie"
9
- require "action_controller/railtie"
10
- require "action_mailer/railtie"
11
- require "active_resource/railtie"
12
- #require "rails/test_unit/railtie"
13
-
14
-
15
-
16
- # If you have a Gemfile, require the gems listed there, including any gems
17
- # you've limited to :test, :development, or :production.
18
- Bundler.require(:default, $ORM_ENGINE, Rails.env) if defined?(Bundler)
19
-
20
- module WhowishWordRails
21
-
22
- class Application < Rails::Application
23
-
24
- config.encoding = "utf-8"
25
- config.filter_parameters += [:password]
26
- config.active_support.deprecation = :stderr
27
-
28
- end
29
-
30
- end
1
+ $ORM_ENGINE = :active_record
2
+ #$ORM_ENGINE = :mongoid
3
+
4
+ require File.expand_path('../boot', __FILE__)
5
+
6
+ # Pick the frameworks you want:
7
+
8
+ require "active_record/railtie"
9
+ require "action_controller/railtie"
10
+ require "action_mailer/railtie"
11
+ require "active_resource/railtie"
12
+ #require "rails/test_unit/railtie"
13
+
14
+
15
+
16
+ # If you have a Gemfile, require the gems listed there, including any gems
17
+ # you've limited to :test, :development, or :production.
18
+ Bundler.require(:default, $ORM_ENGINE, Rails.env) if defined?(Bundler)
19
+
20
+ module WhowishWordRails
21
+
22
+ class Application < Rails::Application
23
+
24
+ config.encoding = "utf-8"
25
+ config.filter_parameters += [:password]
26
+ config.active_support.deprecation = :stderr
27
+
28
+ end
29
+
30
+ end
data/rails/config/boot.rb CHANGED
@@ -1,9 +1,9 @@
1
- require 'rubygems'
2
-
3
- # Set up gems listed in the Gemfile.
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
-
6
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
7
-
8
-
9
- require File.expand_path('../../../lib/whowish_word', __FILE__)
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
7
+
8
+
9
+ require File.expand_path('../../../lib/whowish_word', __FILE__)
@@ -1,25 +1,25 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
25
  timeout: 5000
@@ -1,16 +1,16 @@
1
-
2
- # Load the rails application
3
- require File.expand_path('../application', __FILE__)
4
-
5
-
6
- if $ORM_ENGINE == :mongoid
7
- require File.expand_path('../mongoid', __FILE__)
8
- end
9
-
10
- # Initialize the rails application
11
- WhowishWordRails::Application.initialize!
12
-
13
- WhowishWordRails::Application.config.secret_token = '81c5a4d251df513e47294d8ca73770dd43039b821f06e0a6161f93f1cbdfecd1d7e57f20ceeb6c2ce7e12e5b595c55808a403859cc4b0c324c4760bac9645bb9'
14
-
15
- Rails.logger = Logger.new(STDOUT)
16
-
1
+
2
+ # Load the rails application
3
+ require File.expand_path('../application', __FILE__)
4
+
5
+
6
+ if $ORM_ENGINE == :mongoid
7
+ require File.expand_path('../mongoid', __FILE__)
8
+ end
9
+
10
+ # Initialize the rails application
11
+ WhowishWordRails::Application.initialize!
12
+
13
+ WhowishWordRails::Application.config.secret_token = '81c5a4d251df513e47294d8ca73770dd43039b821f06e0a6161f93f1cbdfecd1d7e57f20ceeb6c2ce7e12e5b595c55808a403859cc4b0c324c4760bac9645bb9'
14
+
15
+ Rails.logger = Logger.new(STDOUT)
16
+
@@ -1,3 +1,3 @@
1
-
2
- WhowishWord.init($ORM_ENGINE)
3
-
1
+
2
+ WhowishWord.init($ORM_ENGINE)
3
+
@@ -1,6 +1,6 @@
1
- mongoid_conf = YAML::load_file(Rails.root.join('config/mongoid.yml'))[Rails.env]
2
-
3
- Mongoid.configure do |config|
4
- config.master = Mongo::Connection.new(mongoid_conf['host'],
5
- mongoid_conf['port']).db(mongoid_conf['database'])
6
- end
1
+ mongoid_conf = YAML::load_file(Rails.root.join('config/mongoid.yml'))[Rails.env]
2
+
3
+ Mongoid.configure do |config|
4
+ config.master = Mongo::Connection.new(mongoid_conf['host'],
5
+ mongoid_conf['port']).db(mongoid_conf['database'])
6
+ end
@@ -1,14 +1,14 @@
1
- development:
2
- host: localhost
3
- port: 27017
4
- database: whowish_word
5
-
6
- test:
7
- host: localhost
8
- port: 27017
9
- database: whowish_word_test
10
-
11
- production:
12
- host: localhost
13
- port: 27017
14
- database: whowish_word
1
+ development:
2
+ host: localhost
3
+ port: 27017
4
+ database: whowish_word
5
+
6
+ test:
7
+ host: localhost
8
+ port: 27017
9
+ database: whowish_word_test
10
+
11
+ production:
12
+ host: localhost
13
+ port: 27017
14
+ database: whowish_word
@@ -1,7 +1,7 @@
1
- WhowishWordRails::Application.routes.draw do
2
-
3
- root :to => "home#index"
4
-
5
- match ':controller(/:action(/:id(.:format)))'
6
-
7
- end
1
+ WhowishWordRails::Application.routes.draw do
2
+
3
+ root :to => "home#index"
4
+
5
+ match ':controller(/:action(/:id(.:format)))'
6
+
7
+ end
data/rails/config.ru CHANGED
@@ -1,4 +1,4 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run WhowishWordRails::Application
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run WhowishWordRails::Application
data/rails/log/.gitignore CHANGED
@@ -1,2 +1,2 @@
1
-
1
+
2
2
  *.log
data/rails/mongo.bat CHANGED
@@ -1,5 +1,5 @@
1
- del C:\mongodb\data\mongod.lock
2
- del C:\mongodb\data\db\mongod.lock
3
- C:\mongodb\bin\mongod --repair
4
- C:\mongodb\bin\mongod -v --dbpath "C:\mongodb\data\db"
1
+ del C:\mongodb\data\mongod.lock
2
+ del C:\mongodb\data\db\mongod.lock
3
+ C:\mongodb\bin\mongod --repair
4
+ C:\mongodb\bin\mongod -v --dbpath "C:\mongodb\data\db"
5
5
  pause
@@ -1,72 +1,72 @@
1
- (function($){
2
-
3
- $.fn.extend({
4
-
5
- loading_icon:function(enabled)
6
- {
7
- return this.each(function() {
8
-
9
- if (enabled == true)
10
- {
11
- if (this.loading == true) return;
12
- this.loading = true;
13
- this.save_background = $(this).css('background-image');
14
- $(this).css('background-image','url()');
15
-
16
- $(this).html('<span style="display:inline-block;width:100%;height:100%;vertical-align:top;background-image:url(/loading_button/loading.gif);background-repeat:no-repeat;" onclick="if (event.stopPropagation) event.stopPropagation();event.cancelBubble = true;return false;"></span>');
17
- }
18
- else
19
- {
20
- if (this.loading == undefined || this.loading == false) return;
21
- this.loading = false;
22
- $(this).html('');
23
- $(this).css('background-image',this.save_background);
24
- }
25
-
26
- });
27
-
28
- },
29
-
30
- //pass the options variable to the function
31
- loading_button: function(enabled,options) {
32
-
33
-
34
- //Set the default values, use comma to separate the settings, example:
35
- var defaults = {
36
- image : '<img src="/loading_button/loading.gif">',
37
- word: 'Loading'
38
- }
39
-
40
- var options = $.extend(defaults, options);
41
-
42
- return this.each(function() {
43
-
44
- if (enabled == true)
45
- {
46
- var inside_content = $(this).html();
47
- //var action = $(this).attr('onclick');
48
-
49
- //$(this).html('<span style="display:block;width:100%;height:100%;" onclick="if (event.stopPropagation) event.stopPropagation();event.cancelBubble = true;">'+options.image + ' ' + options.word+'</span>');
50
- $(this).html('<span style="display:inline-block;width:100%;height:100%;" onclick="if (event.stopPropagation) event.stopPropagation();event.cancelBubble = true;return false;">'+options.image + ' ' + options.word+'</span>');
51
-
52
- $(this).append('<span class="loading_button_hidden_div" style="display: none;">'+inside_content+'</span>');
53
- //$(this).append('<span class="loading_button_hidden_div_action" style="display: none;">'+action+'</span>');
54
- }
55
- else
56
- {
57
- var hidden_div = $('.loading_button_hidden_div',this);
58
- //var hidden_div_action = $('.loading_button_hidden_div_action',this);
59
-
60
- if (hidden_div.length == 0) return;
61
-
62
- $(this).html($(hidden_div).html());
63
- //alert($(hidden_div_action).html())
64
- //$(this).attr('onclick',$(hidden_div_action).html());
65
- }
66
-
67
- });
68
- }
69
- });
70
-
71
- })(jQuery);
72
-
1
+ (function($){
2
+
3
+ $.fn.extend({
4
+
5
+ loading_icon:function(enabled)
6
+ {
7
+ return this.each(function() {
8
+
9
+ if (enabled == true)
10
+ {
11
+ if (this.loading == true) return;
12
+ this.loading = true;
13
+ this.save_background = $(this).css('background-image');
14
+ $(this).css('background-image','url()');
15
+
16
+ $(this).html('<span style="display:inline-block;width:100%;height:100%;vertical-align:top;background-image:url(/loading_button/loading.gif);background-repeat:no-repeat;" onclick="if (event.stopPropagation) event.stopPropagation();event.cancelBubble = true;return false;"></span>');
17
+ }
18
+ else
19
+ {
20
+ if (this.loading == undefined || this.loading == false) return;
21
+ this.loading = false;
22
+ $(this).html('');
23
+ $(this).css('background-image',this.save_background);
24
+ }
25
+
26
+ });
27
+
28
+ },
29
+
30
+ //pass the options variable to the function
31
+ loading_button: function(enabled,options) {
32
+
33
+
34
+ //Set the default values, use comma to separate the settings, example:
35
+ var defaults = {
36
+ image : '<img src="/loading_button/loading.gif">',
37
+ word: 'Loading'
38
+ }
39
+
40
+ var options = $.extend(defaults, options);
41
+
42
+ return this.each(function() {
43
+
44
+ if (enabled == true)
45
+ {
46
+ var inside_content = $(this).html();
47
+ //var action = $(this).attr('onclick');
48
+
49
+ //$(this).html('<span style="display:block;width:100%;height:100%;" onclick="if (event.stopPropagation) event.stopPropagation();event.cancelBubble = true;">'+options.image + ' ' + options.word+'</span>');
50
+ $(this).html('<span style="display:inline-block;width:100%;height:100%;" onclick="if (event.stopPropagation) event.stopPropagation();event.cancelBubble = true;return false;">'+options.image + ' ' + options.word+'</span>');
51
+
52
+ $(this).append('<span class="loading_button_hidden_div" style="display: none;">'+inside_content+'</span>');
53
+ //$(this).append('<span class="loading_button_hidden_div_action" style="display: none;">'+action+'</span>');
54
+ }
55
+ else
56
+ {
57
+ var hidden_div = $('.loading_button_hidden_div',this);
58
+ //var hidden_div_action = $('.loading_button_hidden_div_action',this);
59
+
60
+ if (hidden_div.length == 0) return;
61
+
62
+ $(this).html($(hidden_div).html());
63
+ //alert($(hidden_div_action).html())
64
+ //$(this).attr('onclick',$(hidden_div_action).html());
65
+ }
66
+
67
+ });
68
+ }
69
+ });
70
+
71
+ })(jQuery);
72
+
@@ -1,26 +1,26 @@
1
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
- <html>
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5
- <title>Untitled Document</title>
6
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
7
- <script type="text/javascript">
8
- console.log("1.6.4 = " + $().jquery);
9
- </script>
10
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js" type="text/javascript"></script>
11
- <script type="text/javascript">
12
- console.log("1.6.3 = " + $().jquery);
13
- var $$jj = $.noConflict();
14
-
15
- console.log("1.6.4 = " + $().jquery);
16
- console.log("1.6.3 = " + $$jj().jquery);
17
- </script>
18
- <script src="../javascripts/jquery-1.6.2.min.js" type="text/javascript"></script>
19
- <script type="text/javascript">
20
- console.log("1.6.4 = " + $().jquery);
21
- console.log("1.6.2 = " + $j().jquery);
22
- </script>
23
- </head>
24
- <body>
25
- </body>
26
- </html>
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
5
+ <title>Untitled Document</title>
6
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
7
+ <script type="text/javascript">
8
+ console.log("1.6.4 = " + $().jquery);
9
+ </script>
10
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js" type="text/javascript"></script>
11
+ <script type="text/javascript">
12
+ console.log("1.6.3 = " + $().jquery);
13
+ var $$jj = $.noConflict();
14
+
15
+ console.log("1.6.4 = " + $().jquery);
16
+ console.log("1.6.3 = " + $$jj().jquery);
17
+ </script>
18
+ <script src="../javascripts/jquery-1.6.2.min.js" type="text/javascript"></script>
19
+ <script type="text/javascript">
20
+ console.log("1.6.4 = " + $().jquery);
21
+ console.log("1.6.2 = " + $j().jquery);
22
+ </script>
23
+ </head>
24
+ <body>
25
+ </body>
26
+ </html>
data/rails/script/rails CHANGED
@@ -1,6 +1,6 @@
1
- #!/usr/bin/env ruby.exe
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
1
+ #!/usr/bin/env ruby.exe
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -1,56 +1,56 @@
1
- require 'spec_helper'
2
-
3
- describe WhowishWordController do
4
-
5
- it "adds a word correctly" do
6
-
7
- word_id = "some_controller/some_view.html.erb:some_word(en)"
8
- content = "Hello"
9
-
10
- post :change_word, {
11
- :word_id => word_id,
12
- :content => content
13
- }
14
-
15
- body = expect_json_response
16
- body['ok'].should be_true
17
-
18
- commit_database
19
-
20
- word = WhowishWordHtml.first(:conditions=>{:word_id=>word_id})
21
- word.content.should == content
22
-
23
- WhowishWord.words[word_id].should == content
24
- WhowishWord.words.length.should == 1
25
-
26
- end
27
-
28
- it "changes a word correctly" do
29
-
30
- word_id = "some_controller/some_view.html.erb:some_word(en)"
31
- content = "Hello"
32
-
33
- WhowishWord.add_or_set_word(word_id, content)
34
- WhowishWordHtml.create(:word_id=>word_id, :content=>content)
35
-
36
- new_content = "Yo!"
37
-
38
- post :change_word, {
39
- :word_id => word_id,
40
- :content => new_content
41
- }
42
-
43
- body = expect_json_response
44
- body['ok'].should be_true
45
-
46
- commit_database
47
-
48
- word = WhowishWordHtml.first(:conditions=>{:word_id=>word_id})
49
- word.content.should == new_content
50
-
51
- WhowishWord.words[word_id].should == new_content
52
- WhowishWord.words.length.should == 1
53
-
54
- end
55
-
1
+ require 'spec_helper'
2
+
3
+ describe WhowishWordController do
4
+
5
+ it "adds a word correctly" do
6
+
7
+ word_id = "some_controller/some_view.html.erb:some_word(en)"
8
+ content = "Hello"
9
+
10
+ post :change_word, {
11
+ :word_id => word_id,
12
+ :content => content
13
+ }
14
+
15
+ body = expect_json_response
16
+ body['ok'].should be_true
17
+
18
+ commit_database
19
+
20
+ word = WhowishWordHtml.first(:conditions=>{:word_id=>word_id})
21
+ word.content.should == content
22
+
23
+ WhowishWord.words[word_id].should == content
24
+ WhowishWord.words.length.should == 1
25
+
26
+ end
27
+
28
+ it "changes a word correctly" do
29
+
30
+ word_id = "some_controller/some_view.html.erb:some_word(en)"
31
+ content = "Hello"
32
+
33
+ WhowishWord.add_or_set_word(word_id, content)
34
+ WhowishWordHtml.create(:word_id=>word_id, :content=>content)
35
+
36
+ new_content = "Yo!"
37
+
38
+ post :change_word, {
39
+ :word_id => word_id,
40
+ :content => new_content
41
+ }
42
+
43
+ body = expect_json_response
44
+ body['ok'].should be_true
45
+
46
+ commit_database
47
+
48
+ word = WhowishWordHtml.first(:conditions=>{:word_id=>word_id})
49
+ word.content.should == new_content
50
+
51
+ WhowishWord.words[word_id].should == new_content
52
+ WhowishWord.words.length.should == 1
53
+
54
+ end
55
+
56
56
  end