whowish_word 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/.gitignore +3 -1
  2. data/.project +0 -1
  3. data/README.md +20 -26
  4. data/lib/whowish_word/action_controller/base.rb +15 -29
  5. data/lib/whowish_word/action_mailer/base.rb +3 -8
  6. data/lib/whowish_word/action_view/base.rb +52 -41
  7. data/lib/whowish_word/action_view/template.rb +18 -18
  8. data/lib/whowish_word/authentication.rb +9 -9
  9. data/lib/whowish_word/config.rb +1 -10
  10. data/lib/whowish_word/db_migration/active_record/whowish_word_html.rb +10 -10
  11. data/lib/whowish_word/db_migration/mongoid/whowish_word_html.rb +5 -5
  12. data/lib/whowish_word/initializer.rb +4 -4
  13. data/lib/whowish_word/rails/app/controllers/whowish_word_controller.rb +35 -26
  14. data/lib/whowish_word/rails/app/models/active_record/whowish_word_html.rb +2 -2
  15. data/lib/whowish_word/rails/app/models/mongoid/whowish_word_html.rb +6 -6
  16. data/lib/whowish_word/whowish_word.rb +17 -18
  17. data/rails/Gemfile +1 -2
  18. data/rails/Gemfile.lock +77 -75
  19. data/rails/app/assets/javascripts/home2.js +2 -0
  20. data/rails/app/assets/stylesheets/home2.css +4 -0
  21. data/rails/app/controllers/application_controller.rb +1 -1
  22. data/rails/app/controllers/home2_controller.rb +2 -0
  23. data/rails/app/helpers/home2_helper.rb +2 -0
  24. data/rails/app/views/home/index.html.erb +31 -30
  25. data/rails/app/views/home2/index.html.erb +4 -0
  26. data/rails/app/views/integration/attr.html.erb +1 -1
  27. data/rails/app/views/integration/index.html.erb +1 -1
  28. data/rails/app/views/integration/select.html.erb +1 -1
  29. data/rails/app/views/integration/value.html.erb +1 -1
  30. data/rails/config/application.rb +0 -2
  31. data/rails/config/initializers/whowish_word.rb +1 -1
  32. data/rails/config/locales/whowish_word/en.yml +4 -0
  33. data/rails/config/locales/whowish_word/jp.yml +4 -0
  34. data/rails/config/locales/whowish_word/th.yml +4 -0
  35. data/rails/spec/controllers/whowish_word_controller_spec.rb +2 -39
  36. data/rails/spec/integration/whowish_word_spec.rb +1 -16
  37. data/rails/spec/spec_helper.rb +1 -11
  38. data/spec/spec_helper.rb +2 -0
  39. data/whowish_word.gemspec +2 -2
  40. metadata +13 -81
  41. data/ISSUE.md +0 -93
  42. data/rails/spec/integration/whowish_word_generator_spec.rb +0 -140
  43. data/rails/spec/support/mongoid_helper.rb +0 -10
  44. data/spec/unit/word_for_attr_in_edit_mode_spec.rb +0 -44
  45. data/spec/unit/word_for_attr_spec.rb +0 -44
  46. data/spec/unit/word_for_in_edit_mode_spec.rb +0 -44
  47. data/spec/unit/word_for_spec.rb +0 -44
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whowish_word
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,9 +9,9 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-05 00:00:00.000000000Z
12
+ date: 2012-06-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: A Rails gem that make static content editable
14
+ description: Inline internationlization for Rails 3.2.*
15
15
  email:
16
16
  - tanin47@yahoo.com
17
17
  executables: []
@@ -23,7 +23,6 @@ files:
23
23
  - .project
24
24
  - Gemfile
25
25
  - HOW_TO_BUILD_WHOWISH_HOOK.md
26
- - ISSUE.md
27
26
  - README.md
28
27
  - lib/whowish_word.rb
29
28
  - lib/whowish_word/action_controller/base.rb
@@ -71,23 +70,28 @@ files:
71
70
  - rails/Gemfile
72
71
  - rails/Gemfile.lock
73
72
  - rails/Rakefile
73
+ - rails/app/assets/javascripts/home2.js
74
74
  - rails/app/assets/javascripts/integration.js
75
75
  - rails/app/assets/javascripts/test_javascript.js
76
76
  - rails/app/assets/javascripts/test_word_for.js
77
+ - rails/app/assets/stylesheets/home2.css
77
78
  - rails/app/assets/stylesheets/integration.css
78
79
  - rails/app/assets/stylesheets/test_javascript.css
79
80
  - rails/app/assets/stylesheets/test_word_for.css
80
81
  - rails/app/controllers/application_controller.rb
82
+ - rails/app/controllers/home2_controller.rb
81
83
  - rails/app/controllers/home_controller.rb
82
84
  - rails/app/controllers/integration_controller.rb
83
85
  - rails/app/controllers/test_javascript_controller.rb
84
86
  - rails/app/controllers/test_word_for_controller.rb
87
+ - rails/app/helpers/home2_helper.rb
85
88
  - rails/app/helpers/integration_helper.rb
86
89
  - rails/app/helpers/test_javascript_helper.rb
87
90
  - rails/app/helpers/test_word_for_helper.rb
88
91
  - rails/app/views/home/index.html.erb
89
92
  - rails/app/views/home/static_edit.html.erb
90
93
  - rails/app/views/home/static_edit_select.html.erb
94
+ - rails/app/views/home2/index.html.erb
91
95
  - rails/app/views/integration/attr.html.erb
92
96
  - rails/app/views/integration/index.html.erb
93
97
  - rails/app/views/integration/select.html.erb
@@ -108,6 +112,9 @@ files:
108
112
  - rails/config/database.yml
109
113
  - rails/config/environment.rb
110
114
  - rails/config/initializers/whowish_word.rb
115
+ - rails/config/locales/whowish_word/en.yml
116
+ - rails/config/locales/whowish_word/jp.yml
117
+ - rails/config/locales/whowish_word/th.yml
111
118
  - rails/config/mongoid.rb
112
119
  - rails/config/mongoid.yml
113
120
  - rails/config/routes.rb
@@ -126,17 +133,11 @@ files:
126
133
  - rails/public/test/jquery_version.html
127
134
  - rails/script/rails
128
135
  - rails/spec/controllers/whowish_word_controller_spec.rb
129
- - rails/spec/integration/whowish_word_generator_spec.rb
130
136
  - rails/spec/integration/whowish_word_spec.rb
131
137
  - rails/spec/spec_helper.rb
132
138
  - rails/spec/support/browser.rb
133
139
  - rails/spec/support/json_rspec_helper.rb
134
- - rails/spec/support/mongoid_helper.rb
135
140
  - spec/spec_helper.rb
136
- - spec/unit/word_for_attr_in_edit_mode_spec.rb
137
- - spec/unit/word_for_attr_spec.rb
138
- - spec/unit/word_for_in_edit_mode_spec.rb
139
- - spec/unit/word_for_spec.rb
140
141
  - whowish_word.gemspec
141
142
  homepage: http://github.com/tanin47/whowish_word
142
143
  licenses: []
@@ -158,77 +159,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
159
  version: '0'
159
160
  requirements: []
160
161
  rubyforge_project: whowish_word
161
- rubygems_version: 1.8.10
162
+ rubygems_version: 1.8.21
162
163
  signing_key:
163
164
  specification_version: 3
164
165
  summary: WhowishWord
165
- test_files:
166
- - rails/Gemfile
167
- - rails/Gemfile.lock
168
- - rails/Rakefile
169
- - rails/app/assets/javascripts/integration.js
170
- - rails/app/assets/javascripts/test_javascript.js
171
- - rails/app/assets/javascripts/test_word_for.js
172
- - rails/app/assets/stylesheets/integration.css
173
- - rails/app/assets/stylesheets/test_javascript.css
174
- - rails/app/assets/stylesheets/test_word_for.css
175
- - rails/app/controllers/application_controller.rb
176
- - rails/app/controllers/home_controller.rb
177
- - rails/app/controllers/integration_controller.rb
178
- - rails/app/controllers/test_javascript_controller.rb
179
- - rails/app/controllers/test_word_for_controller.rb
180
- - rails/app/helpers/integration_helper.rb
181
- - rails/app/helpers/test_javascript_helper.rb
182
- - rails/app/helpers/test_word_for_helper.rb
183
- - rails/app/views/home/index.html.erb
184
- - rails/app/views/home/static_edit.html.erb
185
- - rails/app/views/home/static_edit_select.html.erb
186
- - rails/app/views/integration/attr.html.erb
187
- - rails/app/views/integration/index.html.erb
188
- - rails/app/views/integration/select.html.erb
189
- - rails/app/views/integration/value.html.erb
190
- - rails/app/views/layouts/integration.html.erb
191
- - rails/app/views/layouts/main.html.erb
192
- - rails/app/views/layouts/nested_test_word_for.html.erb
193
- - rails/app/views/layouts/test_javascript.html.erb
194
- - rails/app/views/layouts/test_word_for.html.erb
195
- - rails/app/views/test_javascript/change_value.html.erb
196
- - rails/app/views/test_javascript/index.html.erb
197
- - rails/app/views/test_javascript/replace_with_html.html.erb
198
- - rails/app/views/test_word_for/_partial.html.erb
199
- - rails/app/views/test_word_for/index.html.erb
200
- - rails/config.ru
201
- - rails/config/application.rb
202
- - rails/config/boot.rb
203
- - rails/config/database.yml
204
- - rails/config/environment.rb
205
- - rails/config/initializers/whowish_word.rb
206
- - rails/config/mongoid.rb
207
- - rails/config/mongoid.yml
208
- - rails/config/routes.rb
209
- - rails/db/.gitdummy
210
- - rails/log/.gitignore
211
- - rails/mongo.bat
212
- - rails/public/jasmine/MIT.LICENSE
213
- - rails/public/jasmine/jasmine-html.js
214
- - rails/public/jasmine/jasmine.css
215
- - rails/public/jasmine/jasmine.js
216
- - rails/public/jasmine/jasmine_favicon.png
217
- - rails/public/javascripts/jquery-1.6.4.js
218
- - rails/public/javascripts/jquery.loading_button.js
219
- - rails/public/sinonjs/sinonjs.js
220
- - rails/public/stylesheets/main.css
221
- - rails/public/test/jquery_version.html
222
- - rails/script/rails
223
- - rails/spec/controllers/whowish_word_controller_spec.rb
224
- - rails/spec/integration/whowish_word_generator_spec.rb
225
- - rails/spec/integration/whowish_word_spec.rb
226
- - rails/spec/spec_helper.rb
227
- - rails/spec/support/browser.rb
228
- - rails/spec/support/json_rspec_helper.rb
229
- - rails/spec/support/mongoid_helper.rb
230
- - spec/spec_helper.rb
231
- - spec/unit/word_for_attr_in_edit_mode_spec.rb
232
- - spec/unit/word_for_attr_spec.rb
233
- - spec/unit/word_for_in_edit_mode_spec.rb
234
- - spec/unit/word_for_spec.rb
166
+ test_files: []
data/ISSUE.md DELETED
@@ -1,93 +0,0 @@
1
- Current issues
2
- ==================
3
-
4
-
5
-
6
- Support different database engine
7
- -------------------------------------------------
8
-
9
- It is painful to use WhowishWord on different database (MySQL, PostgreSQL, MongoDB, Redis, ...).
10
-
11
- Here is a cycle for a database
12
-
13
- - Initialize structure
14
- - Save migration version
15
- - Rails uses it
16
- - Do another migration
17
- - Save the new version
18
-
19
- There must be a better way that:
20
- - lets user configure easily
21
- - does not depend on 3rd library (No ORM. Really? Should we do that?)
22
- - ActiveRecord is ok
23
- - Mongoid is not, because it is not a standard
24
- -
25
-
26
- ### Solution
27
-
28
- Just Support them directly...
29
-
30
-
31
- ### (Not good) Solution
32
-
33
- Use SQLite instead.
34
- However, this poses another problem. SQLite cannot be run on Cloud service, e.g. Heroku.
35
-
36
-
37
-
38
-
39
-
40
- A way to activate edit mode (Solved!)
41
- -------------------------------------------------
42
-
43
- It should be activate-able inside Rails application, e.g. a call to WhowishWord.activate_edit_mode.
44
- We let user manage its own session.
45
-
46
- The thing to look out is that we have to be careful about using a global variable within WhowishWord gem
47
- because it is shared among users....
48
-
49
- ### Solution
50
-
51
- Create a single point of activating an edit mode, WhowishWord.activate_edit_mode()
52
-
53
-
54
-
55
- Javascript text issue (Solved!)
56
- ----------------------
57
-
58
- Javascript text being enclosed with single-quotes causes an error
59
- (Even if we'd change to double-quotes enclosing, there would still be a problem)
60
-
61
-
62
- ### Solution 1
63
-
64
- User is responsible to make sure that all quotes are escaped.
65
-
66
- Input text attributes (Solved!)
67
- ----------------------
68
-
69
- In edit mode, we cannot add edit icon next to the element, which owns the attribute.
70
-
71
- ### Solution
72
-
73
- Use javascript to add the edit icon.
74
-
75
- 1. Generate a unique text in the attribute
76
- 2. Get the element by searching for the unique text
77
- 3. Replace text with a whowish word
78
- 4. Add edit icon to the element
79
-
80
- When getting an element, we have to store the element and the attribute's name in a hash for future use.
81
- This is because the element might not have its own ID.
82
-
83
-
84
- Select box options (Solved!)
85
- ---------------------
86
-
87
- In edit mode, we cannot edit whowish word in option's value and option's text
88
-
89
- ### Solution
90
-
91
- Use javascript to generate edit icon
92
-
93
-
@@ -1,140 +0,0 @@
1
- require 'spec_helper'
2
- require File.expand_path("../../../../lib/whowish_word",__FILE__)
3
-
4
- module WhowishWordRspecHelper
5
-
6
- include WhowishWord::Constant
7
-
8
- def get_whowish_word(namespace, id, variables={})
9
-
10
- var_keys= []
11
- variables.each_pair { |key,value|
12
- var_keys.push(key)
13
- }
14
-
15
- variables_clause = ""
16
- variables_clause = "{#{var_keys.join(',')}}" if var_keys.length > 0
17
-
18
- return "#{id}(en)#{variables_clause}"
19
-
20
- end
21
-
22
- def get_whowish_word_in_edit_mode(namespace, id, variables={})
23
-
24
- return "<dfn>#{get_whowish_word_attr_in_edit_mode(namespace, id, variables)}</dfn>"
25
-
26
- end
27
-
28
- def get_whowish_word_attr_in_edit_mode(namespace, id, variables={})
29
-
30
- var_keys = []
31
- variables.each_pair { |key,value|
32
- var_keys.push(key)
33
- }
34
-
35
- variables_params = ""
36
- variables_clause = ""
37
-
38
- variables_params = "|#{var_keys.join(',')}" if var_keys.length > 0
39
- variables_clause = "{#{var_keys.join(',')}}" if var_keys.length > 0
40
-
41
- return PREFIX + \
42
- SEPARATOR + \
43
- "#{namespace}:#{id}(en)#{variables_params}" + \
44
- SEPARATOR + \
45
- "#{id}(en)#{variables_clause}"
46
-
47
- end
48
-
49
- end
50
-
51
- describe 'Generator spec' do
52
-
53
- include WhowishWordRspecHelper
54
-
55
- it "generates word_for correctly for all types of view (in edit mode)" do
56
-
57
- goto '/test_word_for?edit_mode=yes'
58
-
59
- html("view_before_partial").should == get_whowish_word_in_edit_mode("test_word_for/index.html.erb", "text")
60
-
61
- html("view").should == get_whowish_word_in_edit_mode("test_word_for/index.html.erb", "text")
62
- html("view_attr").should == get_whowish_word_attr_in_edit_mode("test_word_for/index.html.erb", "text")
63
-
64
- html("view_with_variables").should == get_whowish_word_in_edit_mode("test_word_for/index.html.erb", "text", {:number=>5,:name=>"tanin"})
65
- html("view_attr_with_variables").should == get_whowish_word_attr_in_edit_mode("test_word_for/index.html.erb", "text", {:number=>5,:name=>"tanin"})
66
-
67
-
68
-
69
- html("partial").should == get_whowish_word_in_edit_mode("test_word_for/_partial.html.erb", "text")
70
- html("partial_attr").should == get_whowish_word_attr_in_edit_mode("test_word_for/_partial.html.erb", "text")
71
-
72
- html("partial_with_variables").should == get_whowish_word_in_edit_mode("test_word_for/_partial.html.erb", "text", {:number=>5,:name=>"tanin"})
73
- html("partial_attr_with_variables").should == get_whowish_word_attr_in_edit_mode("test_word_for/_partial.html.erb", "text", {:number=>5,:name=>"tanin"})
74
-
75
-
76
-
77
- html("nested_layout_before_yield").should == get_whowish_word_in_edit_mode("layouts/nested_test_word_for.html.erb", "text")
78
-
79
- html("nested_layout").should == get_whowish_word_in_edit_mode("layouts/nested_test_word_for.html.erb", "text")
80
- html("nested_layout_attr").should == get_whowish_word_attr_in_edit_mode("layouts/nested_test_word_for.html.erb", "text")
81
-
82
- html("nested_layout_with_variables").should == get_whowish_word_in_edit_mode("layouts/nested_test_word_for.html.erb", "text", {:number=>5,:name=>"tanin"})
83
- html("nested_layout_attr_with_variables").should == get_whowish_word_attr_in_edit_mode("layouts/nested_test_word_for.html.erb", "text", {:number=>5,:name=>"tanin"})
84
-
85
-
86
-
87
- html("layout_before_nested_layout").should == get_whowish_word_in_edit_mode("layouts/test_word_for.html.erb", "text")
88
-
89
- html("layout").should == get_whowish_word_in_edit_mode("layouts/test_word_for.html.erb", "text")
90
- html("layout_attr").should == get_whowish_word_attr_in_edit_mode("layouts/test_word_for.html.erb", "text")
91
-
92
- html("layout_with_variables").should == get_whowish_word_in_edit_mode("layouts/test_word_for.html.erb", "text", {:number=>5,:name=>"tanin"})
93
- html("layout_attr_with_variables").should == get_whowish_word_attr_in_edit_mode("layouts/test_word_for.html.erb", "text", {:number=>5,:name=>"tanin"})
94
-
95
- end
96
-
97
- it "generates word_for correctly for all types of view" do
98
-
99
- goto '/test_word_for'
100
-
101
- html("view_before_partial").should == get_whowish_word("test_word_for/index.html.erb", "text")
102
-
103
- html("view").should == get_whowish_word("test_word_for/index.html.erb", "text")
104
- html("view_attr").should == get_whowish_word("test_word_for/index.html.erb", "text")
105
-
106
- html("view_with_variables").should == get_whowish_word("test_word_for/index.html.erb", "text", {:number=>5,:name=>"tanin"})
107
- html("view_attr_with_variables").should == get_whowish_word("test_word_for/index.html.erb", "text", {:number=>5,:name=>"tanin"})
108
-
109
-
110
-
111
- html("partial").should == get_whowish_word("test_word_for/_partial.html.erb", "text")
112
- html("partial_attr").should == get_whowish_word("test_word_for/_partial.html.erb", "text")
113
-
114
- html("partial_with_variables").should == get_whowish_word("test_word_for/_partial.html.erb", "text", {:number=>5,:name=>"tanin"})
115
- html("partial_attr_with_variables").should == get_whowish_word("test_word_for/_partial.html.erb", "text", {:number=>5,:name=>"tanin"})
116
-
117
-
118
-
119
- html("nested_layout_before_yield").should == get_whowish_word("layouts/nested_test_word_for.html.erb", "text")
120
-
121
- html("nested_layout").should == get_whowish_word("layouts/nested_test_word_for.html.erb", "text")
122
- html("nested_layout_attr").should == get_whowish_word("layouts/nested_test_word_for.html.erb", "text")
123
-
124
- html("nested_layout_with_variables").should == get_whowish_word("layouts/nested_test_word_for.html.erb", "text", {:number=>5,:name=>"tanin"})
125
- html("nested_layout_attr_with_variables").should == get_whowish_word("layouts/nested_test_word_for.html.erb", "text", {:number=>5,:name=>"tanin"})
126
-
127
-
128
-
129
- html("layout_before_nested_layout").should == get_whowish_word("layouts/test_word_for.html.erb", "text")
130
-
131
- html("layout").should == get_whowish_word("layouts/test_word_for.html.erb", "text")
132
- html("layout_attr").should == get_whowish_word("layouts/test_word_for.html.erb", "text")
133
-
134
- html("layout_with_variables").should == get_whowish_word("layouts/test_word_for.html.erb", "text", {:number=>5,:name=>"tanin"})
135
- html("layout_attr_with_variables").should == get_whowish_word("layouts/test_word_for.html.erb", "text", {:number=>5,:name=>"tanin"})
136
-
137
- end
138
-
139
- end
140
-
@@ -1,10 +0,0 @@
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
- end
@@ -1,44 +0,0 @@
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
- end
@@ -1,44 +0,0 @@
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
- end
@@ -1,44 +0,0 @@
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_in_edit_mode("namespace", "id", "en")
13
- value.should == "<dfn>#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)#{WhowishWord::SEPARATOR}id(en)</dfn>"
14
-
15
- end
16
-
17
-
18
- it "with variables, no entry" do
19
-
20
- value = WhowishWord.word_for_in_edit_mode("namespace", "id", "en", :number=>5, :name=>"tanin")
21
- value.should == "<dfn>#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)|number,name#{WhowishWord::SEPARATOR}id(en){number,name}</dfn>"
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_in_edit_mode("namespace", "id", "en")
30
- value.should == "<dfn>#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)#{WhowishWord::SEPARATOR}hello</dfn>"
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_in_edit_mode("namespace", "id", "en", :number=>5, :name=>"tanin")
39
- value.should == "<dfn>#{WhowishWord::PREFIX}#{WhowishWord::SEPARATOR}namespace:id(en)|number,name#{WhowishWord::SEPARATOR}hello tanin for 5 times</dfn>"
40
-
41
- end
42
-
43
-
44
- end
@@ -1,44 +0,0 @@
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("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("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("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("namespace", "id", "en", :number=>5, :name=>"tanin")
39
- value.should == "hello tanin for 5 times"
40
-
41
- end
42
-
43
-
44
- end