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,194 +1,194 @@
1
- # encoding: utf-8
2
- require 'uri'
3
- module Browser
4
-
5
- def goto(url)
6
- browser.goto(url)
7
- browser.execute_script("window.alert = function(msg) { window.lastAlert = msg; }")
8
- sleep(0.1)
9
- end
10
-
11
- def expect_alert(msg)
12
- wait_until { browser.execute_script("return window.lastAlert") == msg }
13
- end
14
-
15
- def click(id)
16
- click_object(element(:id=>id))
17
- end
18
-
19
- def element(*option)
20
- browser.element(*option)
21
- end
22
-
23
-
24
- def click_object(obj)
25
-
26
- inner_click(obj)
27
-
28
- browser.wait(120)
29
- wait_for_ajax
30
- end
31
-
32
-
33
- def inner_click(obj)
34
-
35
- if obj.id != nil and obj.id != ""
36
- position = browser.execute_script "return $('##{obj.id}').css('position');"
37
- left = browser.execute_script "return $('##{obj.id}').css('left');"
38
- top = browser.execute_script "return $('##{obj.id}').css('top');"
39
-
40
- browser.execute_script "$('##{obj.id}').css({position:'fixed',left:'0px',top:'0px'});"
41
- end
42
-
43
- obj.focus
44
-
45
- if ["a","button"].include?(obj.tag_name.downcase)
46
- obj.send_keys "\n"
47
- else
48
- obj.click
49
- end
50
-
51
- begin
52
- if obj.id != nil and obj.id != ""
53
- browser.execute_script "$('##{obj.id}').css({position:'#{position}',left:'#{left}',top:'#{top}'});"
54
- end
55
- rescue
56
- end
57
-
58
- end
59
-
60
- def fill(id,msg,blur=true)
61
-
62
- elem = browser.element(:id=>id)
63
-
64
- if elem.tag_name.downcase == "iframe"
65
- elem.focus
66
- execute_script("$('##{id}').contents().find('body').html('')")
67
- elem.send_keys msg
68
- else
69
- browser.text_field(:id=>id).focus
70
- browser.text_field(:id=>id).set msg
71
- end
72
-
73
- if blur
74
- rand_id = "watir_#{rand(100000)}"
75
- browser.execute_script("$('body').append('<input type=\"button\" id=\"#{rand_id}\" />');")
76
- click rand_id
77
- browser.execute_script("$('##{rand_id}').remove();")
78
- end
79
-
80
- end
81
-
82
- def upload_file(id, file_field_id, file_path)
83
- browser.element(:id=>id).fire_event("onmouseover")
84
- fill(file_field_id, file_path.gsub("/","\\"))
85
- wait_for_ajax
86
- end
87
-
88
- def value(id)
89
- browser.element(:id=>id).value
90
- end
91
-
92
- def html(id)
93
- browser.execute_script("return document.getElementById('#{id}').innerHTML")
94
- end
95
-
96
- def expect_html_to_include(id,content)
97
- begin
98
- wait_until {
99
- b = browser.element(:id=>id)
100
- b.exist? && b.html.include?(content)
101
- }
102
- rescue Watir::Wait::TimeoutError => e
103
- raise Watir::Wait::TimeoutError, "Content is expected to include '#{content}', instead we got '#{html(id)}'"
104
- end
105
- end
106
-
107
-
108
- def current_path
109
- URI.parse(browser.execute_script("return document.location.toString();")).path.chomp('/')
110
- end
111
-
112
- def current_host
113
- URI.parse(browser.execute_script("return document.location.toString();")).host.chomp('/')
114
- end
115
-
116
- def close_window
117
- execute_script('window.close();')
118
- end
119
-
120
- def use_window_if_visible(part_of_url_regexp,&block)
121
-
122
- begin
123
- use_window(part_of_url_regexp,&block)
124
- rescue Watir::Exception::NoMatchingWindowFoundException => e
125
- # ignore it
126
- end
127
- end
128
-
129
-
130
- def use_window(part_of_url_regexp,&block)
131
-
132
- timeout = 30
133
- count = 0
134
- while true
135
-
136
- begin
137
- browser.window(:url => part_of_url_regexp).use(&block)
138
- break
139
- rescue Watir::Exception::NoMatchingWindowFoundException => e
140
- sleep(1)
141
- count += 1
142
- raise e if count > timeout
143
- end
144
-
145
- end
146
-
147
- end
148
-
149
- def wait_until_present(id)
150
- browser.element(:id=>id).wait_until_present
151
- end
152
-
153
- def wait_while_present(id)
154
- browser.element(:id=>id).wait_while_present
155
- end
156
-
157
- def wait_until(&block)
158
- browser.wait_until(&block)
159
- end
160
-
161
- def expect_path_to_be(path)
162
-
163
- begin
164
- if path.instance_of?(Regexp)
165
- wait_until { current_path.match(path) != nil }
166
- else
167
- path = path.chomp('/')
168
- wait_until { current_path == path }
169
- end
170
- rescue Watir::Wait::TimeoutError => e
171
- raise Watir::Wait::TimeoutError, "Path is expected to be '#{path}', instead we got '#{current_path}'"
172
- end
173
-
174
- end
175
-
176
- def exists?(*option)
177
- browser.element(*option).exists?
178
- end
179
-
180
- def execute_script(js)
181
- browser.execute_script(js)
182
- end
183
-
184
- def wait_for_ajax
185
- begin
186
- wait_until { browser.execute_script "return jQuery.active == 0" }
187
- rescue Selenium::WebDriver::Error::UnexpectedJavascriptError
188
- # do nothing
189
- rescue Watir::Wait::TimeoutError => e
190
- raise Watir::Wait::TimeoutError, "Ajax is taking too long"
191
- end
192
- end
193
-
1
+ # encoding: utf-8
2
+ require 'uri'
3
+ module Browser
4
+
5
+ def goto(url)
6
+ browser.goto(url)
7
+ browser.execute_script("window.alert = function(msg) { window.lastAlert = msg; }")
8
+ sleep(0.1)
9
+ end
10
+
11
+ def expect_alert(msg)
12
+ wait_until { browser.execute_script("return window.lastAlert") == msg }
13
+ end
14
+
15
+ def click(id)
16
+ click_object(element(:id=>id))
17
+ end
18
+
19
+ def element(*option)
20
+ browser.element(*option)
21
+ end
22
+
23
+
24
+ def click_object(obj)
25
+
26
+ inner_click(obj)
27
+
28
+ browser.wait(120)
29
+ wait_for_ajax
30
+ end
31
+
32
+
33
+ def inner_click(obj)
34
+
35
+ if obj.id != nil and obj.id != ""
36
+ position = browser.execute_script "return $('##{obj.id}').css('position');"
37
+ left = browser.execute_script "return $('##{obj.id}').css('left');"
38
+ top = browser.execute_script "return $('##{obj.id}').css('top');"
39
+
40
+ browser.execute_script "$('##{obj.id}').css({position:'fixed',left:'0px',top:'0px'});"
41
+ end
42
+
43
+ obj.focus
44
+
45
+ if ["a","button"].include?(obj.tag_name.downcase)
46
+ obj.send_keys "\n"
47
+ else
48
+ obj.click
49
+ end
50
+
51
+ begin
52
+ if obj.id != nil and obj.id != ""
53
+ browser.execute_script "$('##{obj.id}').css({position:'#{position}',left:'#{left}',top:'#{top}'});"
54
+ end
55
+ rescue
56
+ end
57
+
58
+ end
59
+
60
+ def fill(id,msg,blur=true)
61
+
62
+ elem = browser.element(:id=>id)
63
+
64
+ if elem.tag_name.downcase == "iframe"
65
+ elem.focus
66
+ execute_script("$('##{id}').contents().find('body').html('')")
67
+ elem.send_keys msg
68
+ else
69
+ browser.text_field(:id=>id).focus
70
+ browser.text_field(:id=>id).set msg
71
+ end
72
+
73
+ if blur
74
+ rand_id = "watir_#{rand(100000)}"
75
+ browser.execute_script("$('body').append('<input type=\"button\" id=\"#{rand_id}\" />');")
76
+ click rand_id
77
+ browser.execute_script("$('##{rand_id}').remove();")
78
+ end
79
+
80
+ end
81
+
82
+ def upload_file(id, file_field_id, file_path)
83
+ browser.element(:id=>id).fire_event("onmouseover")
84
+ fill(file_field_id, file_path.gsub("/","\\"))
85
+ wait_for_ajax
86
+ end
87
+
88
+ def value(id)
89
+ browser.element(:id=>id).value
90
+ end
91
+
92
+ def html(id)
93
+ browser.execute_script("return document.getElementById('#{id}').innerHTML")
94
+ end
95
+
96
+ def expect_html_to_include(id,content)
97
+ begin
98
+ wait_until {
99
+ b = browser.element(:id=>id)
100
+ b.exist? && b.html.include?(content)
101
+ }
102
+ rescue Watir::Wait::TimeoutError => e
103
+ raise Watir::Wait::TimeoutError, "Content is expected to include '#{content}', instead we got '#{html(id)}'"
104
+ end
105
+ end
106
+
107
+
108
+ def current_path
109
+ URI.parse(browser.execute_script("return document.location.toString();")).path.chomp('/')
110
+ end
111
+
112
+ def current_host
113
+ URI.parse(browser.execute_script("return document.location.toString();")).host.chomp('/')
114
+ end
115
+
116
+ def close_window
117
+ execute_script('window.close();')
118
+ end
119
+
120
+ def use_window_if_visible(part_of_url_regexp,&block)
121
+
122
+ begin
123
+ use_window(part_of_url_regexp,&block)
124
+ rescue Watir::Exception::NoMatchingWindowFoundException => e
125
+ # ignore it
126
+ end
127
+ end
128
+
129
+
130
+ def use_window(part_of_url_regexp,&block)
131
+
132
+ timeout = 30
133
+ count = 0
134
+ while true
135
+
136
+ begin
137
+ browser.window(:url => part_of_url_regexp).use(&block)
138
+ break
139
+ rescue Watir::Exception::NoMatchingWindowFoundException => e
140
+ sleep(1)
141
+ count += 1
142
+ raise e if count > timeout
143
+ end
144
+
145
+ end
146
+
147
+ end
148
+
149
+ def wait_until_present(id)
150
+ browser.element(:id=>id).wait_until_present
151
+ end
152
+
153
+ def wait_while_present(id)
154
+ browser.element(:id=>id).wait_while_present
155
+ end
156
+
157
+ def wait_until(&block)
158
+ browser.wait_until(&block)
159
+ end
160
+
161
+ def expect_path_to_be(path)
162
+
163
+ begin
164
+ if path.instance_of?(Regexp)
165
+ wait_until { current_path.match(path) != nil }
166
+ else
167
+ path = path.chomp('/')
168
+ wait_until { current_path == path }
169
+ end
170
+ rescue Watir::Wait::TimeoutError => e
171
+ raise Watir::Wait::TimeoutError, "Path is expected to be '#{path}', instead we got '#{current_path}'"
172
+ end
173
+
174
+ end
175
+
176
+ def exists?(*option)
177
+ browser.element(*option).exists?
178
+ end
179
+
180
+ def execute_script(js)
181
+ browser.execute_script(js)
182
+ end
183
+
184
+ def wait_for_ajax
185
+ begin
186
+ wait_until { browser.execute_script "return jQuery.active == 0" }
187
+ rescue Selenium::WebDriver::Error::UnexpectedJavascriptError
188
+ # do nothing
189
+ rescue Watir::Wait::TimeoutError => e
190
+ raise Watir::Wait::TimeoutError, "Ajax is taking too long"
191
+ end
192
+ end
193
+
194
194
  end
@@ -1,9 +1,9 @@
1
- # encoding: utf-8
2
- module JsonRspecHelper
3
-
4
- def expect_json_response
5
- response.should be_success
6
- return ActiveSupport::JSON.decode(response.body)
7
- end
8
-
1
+ # encoding: utf-8
2
+ module JsonRspecHelper
3
+
4
+ def expect_json_response
5
+ response.should be_success
6
+ return ActiveSupport::JSON.decode(response.body)
7
+ end
8
+
9
9
  end
@@ -1,10 +1,10 @@
1
- # encoding: utf-8
2
- module MongoidHelper
3
- def commit_database(fsync=true)
4
-
5
- if defined?(Mongoid)
6
- Mongoid.database.command({:getlasterror => 1,:fsync=>true})
7
- end
8
-
9
- end
1
+ # encoding: utf-8
2
+ module MongoidHelper
3
+ def commit_database(fsync=true)
4
+
5
+ if defined?(Mongoid)
6
+ Mongoid.database.command({:getlasterror => 1,:fsync=>true})
7
+ end
8
+
9
+ end
10
10
  end
data/spec/spec_helper.rb CHANGED
@@ -1,19 +1,17 @@
1
- # encoding: utf-8
2
-
3
- require 'rspec'
4
- require File.expand_path("../../lib/whowish_word",__FILE__)
5
-
6
- RSpec.configure do |config|
7
-
8
- config.mock_with :rspec
9
-
10
- String.class_eval do
11
- def html_safe
12
- return self
13
- end
14
- end
15
-
16
- end
17
-
18
-
19
-
1
+ # encoding: utf-8
2
+
3
+ require 'rspec'
4
+ require File.expand_path("../../lib/whowish_word",__FILE__)
5
+
6
+ RSpec.configure do |config|
7
+
8
+ String.class_eval do
9
+ def html_safe
10
+ return self
11
+ end
12
+ end
13
+
14
+ end
15
+
16
+
17
+
@@ -1,44 +1,44 @@
1
- require 'spec_helper'
2
-
3
- describe 'word_for' do
4
-
5
- before(:each) do
6
- WhowishWord.words = {}
7
- end
8
-
9
-
10
- it "no variables, no entry" do
11
-
12
- value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en")
13
- value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)#{WhowishWord::SEPARATOR}id(en)"
14
-
15
- end
16
-
17
-
18
- it "with variables, no entry" do
19
-
20
- value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en", :number=>5, :name=>"tanin")
21
- value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)|number,name#{WhowishWord::SEPARATOR}id(en){number,name}"
22
-
23
- end
24
-
25
-
26
- it "no variables, with entry" do
27
-
28
- WhowishWord.words = {"namespace:id(en)" => "hello"}
29
- value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en")
30
- value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)#{WhowishWord::SEPARATOR}hello"
31
-
32
- end
33
-
34
-
35
- it "with variables, with entry" do
36
-
37
- WhowishWord.words = {"namespace:id(en)" => "hello {name} for {number} times"}
38
- value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en", :number=>5, :name=>"tanin")
39
- value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)|number,name#{WhowishWord::SEPARATOR}hello tanin for 5 times"
40
-
41
- end
42
-
43
-
1
+ require 'spec_helper'
2
+
3
+ describe 'word_for' do
4
+
5
+ before(:each) do
6
+ WhowishWord.words = {}
7
+ end
8
+
9
+
10
+ it "no variables, no entry" do
11
+
12
+ value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en")
13
+ value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)#{WhowishWord::SEPARATOR}id(en)"
14
+
15
+ end
16
+
17
+
18
+ it "with variables, no entry" do
19
+
20
+ value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en", :number=>5, :name=>"tanin")
21
+ value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)|number,name#{WhowishWord::SEPARATOR}id(en){number,name}"
22
+
23
+ end
24
+
25
+
26
+ it "no variables, with entry" do
27
+
28
+ WhowishWord.words = {"namespace:id(en)" => "hello"}
29
+ value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en")
30
+ value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)#{WhowishWord::SEPARATOR}hello"
31
+
32
+ end
33
+
34
+
35
+ it "with variables, with entry" do
36
+
37
+ WhowishWord.words = {"namespace:id(en)" => "hello {name} for {number} times"}
38
+ value = WhowishWord.word_for_attr_in_edit_mode("namespace", "id", "en", :number=>5, :name=>"tanin")
39
+ value.should == "#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)|number,name#{WhowishWord::SEPARATOR}hello tanin for 5 times"
40
+
41
+ end
42
+
43
+
44
44
  end
@@ -1,44 +1,44 @@
1
- require 'spec_helper'
2
-
3
- describe 'word_for_attr' do
4
-
5
- before(:each) do
6
- WhowishWord.words = {}
7
- end
8
-
9
-
10
- it "no variables, no entry" do
11
-
12
- value = WhowishWord.word_for_attr("namespace", "id", "en")
13
- value.should == "id(en)"
14
-
15
- end
16
-
17
-
18
- it "with variables, no entry" do
19
-
20
- value = WhowishWord.word_for_attr("namespace", "id", "en", :number=>5, :name=>"tanin")
21
- value.should == "id(en){number,name}"
22
-
23
- end
24
-
25
-
26
- it "no variables, with entry" do
27
-
28
- WhowishWord.words = {"namespace:id(en)" => "hello"}
29
- value = WhowishWord.word_for_attr("namespace", "id", "en")
30
- value.should == "hello"
31
-
32
- end
33
-
34
-
35
- it "with variables, with entry" do
36
-
37
- WhowishWord.words = {"namespace:id(en)" => "hello {name} for {number} times"}
38
- value = WhowishWord.word_for_attr("namespace", "id", "en", :number=>5, :name=>"tanin")
39
- value.should == "hello tanin for 5 times"
40
-
41
- end
42
-
43
-
1
+ require 'spec_helper'
2
+
3
+ describe 'word_for_attr' do
4
+
5
+ before(:each) do
6
+ WhowishWord.words = {}
7
+ end
8
+
9
+
10
+ it "no variables, no entry" do
11
+
12
+ value = WhowishWord.word_for_attr("namespace", "id", "en")
13
+ value.should == "id(en)"
14
+
15
+ end
16
+
17
+
18
+ it "with variables, no entry" do
19
+
20
+ value = WhowishWord.word_for_attr("namespace", "id", "en", :number=>5, :name=>"tanin")
21
+ value.should == "id(en){number,name}"
22
+
23
+ end
24
+
25
+
26
+ it "no variables, with entry" do
27
+
28
+ WhowishWord.words = {"namespace:id(en)" => "hello"}
29
+ value = WhowishWord.word_for_attr("namespace", "id", "en")
30
+ value.should == "hello"
31
+
32
+ end
33
+
34
+
35
+ it "with variables, with entry" do
36
+
37
+ WhowishWord.words = {"namespace:id(en)" => "hello {name} for {number} times"}
38
+ value = WhowishWord.word_for_attr("namespace", "id", "en", :number=>5, :name=>"tanin")
39
+ value.should == "hello tanin for 5 times"
40
+
41
+ end
42
+
43
+
44
44
  end