whowish_word 0.6.5 → 1.0.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.
- data/.gitignore +2 -2
- data/Gemfile +2 -4
- data/lib/whowish_word/action_controller/base.rb +6 -46
- data/lib/whowish_word/action_view/base.rb +18 -40
- data/lib/whowish_word/backends/defer_to_i18n.rb +18 -0
- data/lib/whowish_word/backends/flat_file_store.rb +75 -0
- data/lib/whowish_word/constant.rb +1 -3
- data/lib/whowish_word/initializer.rb +10 -29
- data/lib/whowish_word/rails/app/controllers/whowish_word_controller.rb +31 -85
- data/lib/whowish_word/whowish_word.rb +3 -6
- data/rails/Gemfile +2 -12
- data/rails/Gemfile.lock +30 -44
- data/rails/app/views/layouts/integration.html.erb +0 -1
- data/rails/config/application.rb +0 -17
- data/rails/config/boot.rb +0 -3
- data/rails/config/environment.rb +0 -9
- data/rails/config/routes.rb +0 -3
- data/rails/spec/controllers/whowish_word_controller_spec.rb +36 -10
- data/rails/spec/features/whowish_word_spec.rb +75 -0
- data/rails/spec/spec_helper.rb +15 -11
- data/rails/spec/support/browser_helper.rb +31 -0
- data/rails/spec/support/json_rspec_helper.rb +0 -3
- data/whowish_word.gemspec +4 -4
- metadata +24 -48
- data/lib/whowish_word/action_mailer/base.rb +0 -7
- data/lib/whowish_word/action_view/template.rb +0 -31
- data/lib/whowish_word/authentication.rb +0 -14
- data/lib/whowish_word/db_migration/active_record/whowish_word_html.rb +0 -15
- data/lib/whowish_word/db_migration/mongoid/whowish_word_html.rb +0 -6
- data/lib/whowish_word/rails/app/models/active_record/whowish_word_html.rb +0 -4
- data/lib/whowish_word/rails/app/models/mongoid/whowish_word_html.rb +0 -9
- data/lib/whowish_word/word_for.rb +0 -94
- data/rails/app/assets/javascripts/home2.js +0 -2
- data/rails/app/assets/javascripts/integration.js +0 -2
- data/rails/app/assets/javascripts/test_javascript.js +0 -2
- data/rails/app/assets/javascripts/test_word_for.js +0 -2
- data/rails/app/assets/stylesheets/home2.css +0 -4
- data/rails/app/assets/stylesheets/integration.css +0 -4
- data/rails/app/assets/stylesheets/test_javascript.css +0 -4
- data/rails/app/assets/stylesheets/test_word_for.css +0 -4
- data/rails/app/controllers/home2_controller.rb +0 -2
- data/rails/app/controllers/test_javascript_controller.rb +0 -11
- data/rails/app/controllers/test_word_for_controller.rb +0 -5
- data/rails/app/helpers/home2_helper.rb +0 -2
- data/rails/app/helpers/test_javascript_helper.rb +0 -2
- data/rails/app/helpers/test_word_for_helper.rb +0 -2
- data/rails/app/views/home2/index.html.erb +0 -2
- data/rails/app/views/home2/test.html.erb +0 -3
- data/rails/app/views/test_javascript/change_value.html.erb +0 -32
- data/rails/app/views/test_javascript/index.html.erb +0 -87
- data/rails/app/views/test_javascript/replace_with_html.html.erb +0 -96
- data/rails/app/views/test_word_for/_partial.html.erb +0 -5
- data/rails/app/views/test_word_for/index.html.erb +0 -9
- data/rails/config/database.yml +0 -25
- data/rails/config/mongoid.rb +0 -6
- data/rails/config/mongoid.yml +0 -14
- data/rails/db/.gitdummy +0 -0
- data/rails/mongo.bat +0 -5
- data/rails/public/jasmine/MIT.LICENSE +0 -20
- data/rails/public/jasmine/jasmine-html.js +0 -190
- data/rails/public/jasmine/jasmine.css +0 -166
- data/rails/public/jasmine/jasmine.js +0 -2476
- data/rails/public/jasmine/jasmine_favicon.png +0 -0
- data/rails/public/javascripts/jquery.loading_button.js +0 -72
- data/rails/public/sinonjs/sinonjs.js +0 -2821
- data/rails/public/test/jquery_version.html +0 -26
- data/rails/spec/integration/whowish_word_spec.rb +0 -102
- data/rails/spec/support/browser.rb +0 -194
- data/spec/spec_helper.rb +0 -19
@@ -1,26 +0,0 @@
|
|
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,102 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'WhowishWord workflow spec' do
|
4
|
-
it "edits a normal text" do
|
5
|
-
goto '/integration?edit_mode=yes'
|
6
|
-
sleep(1)
|
7
|
-
|
8
|
-
click 'whowishWordId0_____html'
|
9
|
-
|
10
|
-
fill "whowishWordDialogContent", "Some new word"
|
11
|
-
click "whowishWordDialogSaveButton"
|
12
|
-
|
13
|
-
html('whowishWordId0').should == "Some new word"
|
14
|
-
|
15
|
-
|
16
|
-
goto '/integration?edit_mode=yes'
|
17
|
-
sleep(1)
|
18
|
-
|
19
|
-
html('whowishWordId0').should == "Some new word"
|
20
|
-
|
21
|
-
click 'whowishWordId0_____html'
|
22
|
-
value("whowishWordDialogContent").should == "Some new word"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "edits a value" do
|
26
|
-
goto '/integration/value?edit_mode=yes'
|
27
|
-
sleep(1)
|
28
|
-
|
29
|
-
click 'whowishWordId0_____value'
|
30
|
-
|
31
|
-
fill "whowishWordDialogContent", "Some new word"
|
32
|
-
click "whowishWordDialogSaveButton"
|
33
|
-
|
34
|
-
value('whowishWordId0').should == "Some new word"
|
35
|
-
|
36
|
-
|
37
|
-
goto '/integration/value?edit_mode=yes'
|
38
|
-
sleep(1)
|
39
|
-
|
40
|
-
value('whowishWordId0').should == "Some new word"
|
41
|
-
|
42
|
-
click 'whowishWordId0_____value'
|
43
|
-
value("whowishWordDialogContent").should == "Some new word"
|
44
|
-
end
|
45
|
-
|
46
|
-
it "edits an attribute" do
|
47
|
-
goto '/integration/attr?edit_mode=yes'
|
48
|
-
sleep(1)
|
49
|
-
|
50
|
-
click 'whowishWordId0_____title'
|
51
|
-
|
52
|
-
fill "whowishWordDialogContent", "Some new word"
|
53
|
-
click "whowishWordDialogSaveButton"
|
54
|
-
|
55
|
-
element(:id=>'whowishWordId0').attribute_value("title").should == "Some new word"
|
56
|
-
|
57
|
-
|
58
|
-
goto '/integration/attr?edit_mode=yes'
|
59
|
-
|
60
|
-
element(:id=>'whowishWordId0').attribute_value("title").should == "Some new word"
|
61
|
-
|
62
|
-
click 'whowishWordId0_____title'
|
63
|
-
element(:id=>'whowishWordId0').attribute_value("title").should == "Some new word"
|
64
|
-
end
|
65
|
-
|
66
|
-
it "edits an option" do
|
67
|
-
goto '/integration/select?edit_mode=yes'
|
68
|
-
sleep(1)
|
69
|
-
|
70
|
-
|
71
|
-
click 'whowishWordId0_____value'
|
72
|
-
|
73
|
-
fill "whowishWordDialogContent", "Some new value"
|
74
|
-
click "whowishWordDialogSaveButton"
|
75
|
-
|
76
|
-
value('whowishWordId0').should == "Some new value"
|
77
|
-
|
78
|
-
|
79
|
-
click 'whowishWordId0_____text'
|
80
|
-
|
81
|
-
fill "whowishWordDialogContent", "Some new text"
|
82
|
-
click "whowishWordDialogSaveButton"
|
83
|
-
|
84
|
-
execute_script('return $("#whowishWordId0").text();').should == "Some new text"
|
85
|
-
|
86
|
-
|
87
|
-
goto '/integration/select?edit_mode=yes'
|
88
|
-
sleep(1)
|
89
|
-
|
90
|
-
value('whowishWordId0').should == "Some new value"
|
91
|
-
|
92
|
-
click 'whowishWordId0_____value'
|
93
|
-
value("whowishWordDialogContent").should == "Some new value"
|
94
|
-
click 'whowishWordDialogCloseButton'
|
95
|
-
|
96
|
-
execute_script('return $("#whowishWordId0").text();').should == "Some new text"
|
97
|
-
|
98
|
-
click 'whowishWordId0_____text'
|
99
|
-
value("whowishWordDialogContent").should == "Some new text"
|
100
|
-
click 'whowishWordDialogCloseButton'
|
101
|
-
end
|
102
|
-
end
|
@@ -1,194 +0,0 @@
|
|
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
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,19 +0,0 @@
|
|
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
|
-
|