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.
- data/.gitignore +5 -5
- data/.loadpath +5 -5
- data/.project +18 -17
- data/Gemfile +2 -2
- data/HOW_TO_BUILD_WHOWISH_HOOK.md +9 -9
- data/ISSUE.md +93 -93
- data/README.md +208 -208
- data/lib/whowish_word/action_controller/base.rb +44 -44
- data/lib/whowish_word/action_mailer/base.rb +11 -11
- data/lib/whowish_word/action_view/base.rb +70 -70
- data/lib/whowish_word/action_view/template.rb +30 -30
- data/lib/whowish_word/authentication.rb +13 -13
- data/lib/whowish_word/config.rb +21 -21
- data/lib/whowish_word/constant.rb +8 -8
- data/lib/whowish_word/db_migration/active_record/whowish_word_html.rb +14 -14
- data/lib/whowish_word/db_migration/mongoid/whowish_word_html.rb +5 -5
- data/lib/whowish_word/initializer.rb +52 -52
- data/lib/whowish_word/rails/app/controllers/whowish_word_controller.rb +60 -60
- data/lib/whowish_word/rails/app/models/active_record/whowish_word_html.rb +3 -3
- data/lib/whowish_word/rails/app/models/mongoid/whowish_word_html.rb +8 -8
- data/lib/whowish_word/rails/public/javascripts/0_jquery-1.6.4-whowish_word.js +9046 -9046
- data/lib/whowish_word/rails/public/javascripts/1_csrf_token_hook.js +9 -9
- data/lib/whowish_word/rails/public/javascripts/1_jquery.loading_button.js +66 -66
- data/lib/whowish_word/rails/public/javascripts/2_whowish_word_variables.js +33 -33
- data/lib/whowish_word/rails/public/javascripts/3_whowish_word_dialog.js +136 -136
- data/lib/whowish_word/rails/public/javascripts/3_whowish_word_helper.js +116 -116
- data/lib/whowish_word/rails/public/javascripts/4_whowish_word_creator.js +69 -69
- data/lib/whowish_word/whowish_word.rb +41 -41
- data/lib/whowish_word/word_for.rb +93 -93
- data/rails/Gemfile +18 -18
- data/rails/Gemfile.lock +63 -64
- data/rails/app/controllers/application_controller.rb +22 -22
- data/rails/app/controllers/home_controller.rb +8 -8
- data/rails/app/views/home/index.html.erb +109 -109
- data/rails/app/views/home/static_edit.html.erb +50 -50
- data/rails/app/views/home/static_edit_select.html.erb +8 -8
- data/rails/app/views/integration/attr.html.erb +1 -1
- data/rails/app/views/integration/index.html.erb +1 -1
- data/rails/app/views/integration/select.html.erb +3 -3
- data/rails/app/views/integration/value.html.erb +1 -1
- data/rails/app/views/layouts/integration.html.erb +14 -14
- data/rails/app/views/layouts/main.html.erb +13 -13
- data/rails/app/views/layouts/nested_test_word_for.html.erb +17 -17
- data/rails/app/views/layouts/test_javascript.html.erb +13 -13
- data/rails/app/views/layouts/test_word_for.html.erb +24 -24
- data/rails/app/views/test_javascript/change_value.html.erb +32 -32
- data/rails/app/views/test_javascript/index.html.erb +87 -87
- data/rails/app/views/test_javascript/replace_with_html.html.erb +96 -96
- data/rails/app/views/test_word_for/_partial.html.erb +4 -4
- data/rails/app/views/test_word_for/index.html.erb +8 -8
- data/rails/config/application.rb +30 -30
- data/rails/config/boot.rb +9 -9
- data/rails/config/database.yml +24 -24
- data/rails/config/environment.rb +16 -16
- data/rails/config/initializers/whowish_word.rb +3 -3
- data/rails/config/mongoid.rb +6 -6
- data/rails/config/mongoid.yml +14 -14
- data/rails/config/routes.rb +7 -7
- data/rails/config.ru +4 -4
- data/rails/log/.gitignore +1 -1
- data/rails/mongo.bat +4 -4
- data/rails/public/javascripts/jquery.loading_button.js +72 -72
- data/rails/public/test/jquery_version.html +26 -26
- data/rails/script/rails +6 -6
- data/rails/spec/controllers/whowish_word_controller_spec.rb +55 -55
- data/rails/spec/integration/whowish_word_generator_spec.rb +139 -139
- data/rails/spec/integration/whowish_word_spec.rb +116 -116
- data/rails/spec/spec_helper.rb +34 -36
- data/rails/spec/support/browser.rb +193 -193
- data/rails/spec/support/json_rspec_helper.rb +8 -8
- data/rails/spec/support/mongoid_helper.rb +9 -9
- data/spec/spec_helper.rb +17 -19
- data/spec/unit/word_for_attr_in_edit_mode_spec.rb +43 -43
- data/spec/unit/word_for_attr_spec.rb +43 -43
- data/spec/unit/word_for_in_edit_mode_spec.rb +43 -43
- data/spec/unit/word_for_spec.rb +43 -43
- data/whowish_word.gemspec +21 -21
- metadata +73 -4
@@ -1,140 +1,140 @@
|
|
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
|
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
140
|
|
@@ -1,117 +1,117 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'WhowishWord workflow spec' do
|
4
|
-
|
5
|
-
it "edits a normal text" do
|
6
|
-
|
7
|
-
goto '/integration?edit_mode=yes'
|
8
|
-
sleep(1)
|
9
|
-
|
10
|
-
click 'whowishWordId0_____html'
|
11
|
-
|
12
|
-
fill "whowishWordDialogContent", "Some new word"
|
13
|
-
click "whowishWordDialogSaveButton"
|
14
|
-
|
15
|
-
html('whowishWordId0').should == "Some new word"
|
16
|
-
|
17
|
-
commit_database
|
18
|
-
|
19
|
-
goto '/integration?edit_mode=yes'
|
20
|
-
sleep(1)
|
21
|
-
|
22
|
-
html('whowishWordId0').should == "Some new word"
|
23
|
-
|
24
|
-
click 'whowishWordId0_____html'
|
25
|
-
value("whowishWordDialogContent").should == "Some new word"
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
it "edits a value" do
|
30
|
-
|
31
|
-
goto '/integration/value?edit_mode=yes'
|
32
|
-
sleep(1)
|
33
|
-
|
34
|
-
click 'whowishWordId0_____value'
|
35
|
-
|
36
|
-
fill "whowishWordDialogContent", "Some new word"
|
37
|
-
click "whowishWordDialogSaveButton"
|
38
|
-
|
39
|
-
value('whowishWordId0').should == "Some new word"
|
40
|
-
|
41
|
-
commit_database
|
42
|
-
|
43
|
-
goto '/integration/value?edit_mode=yes'
|
44
|
-
sleep(1)
|
45
|
-
|
46
|
-
value('whowishWordId0').should == "Some new word"
|
47
|
-
|
48
|
-
click 'whowishWordId0_____value'
|
49
|
-
value("whowishWordDialogContent").should == "Some new word"
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
it "edits an attribute" do
|
54
|
-
|
55
|
-
goto '/integration/attr?edit_mode=yes'
|
56
|
-
sleep(1)
|
57
|
-
|
58
|
-
click 'whowishWordId0_____title'
|
59
|
-
|
60
|
-
fill "whowishWordDialogContent", "Some new word"
|
61
|
-
click "whowishWordDialogSaveButton"
|
62
|
-
|
63
|
-
element(:id=>'whowishWordId0').attribute_value("title").should == "Some new word"
|
64
|
-
|
65
|
-
commit_database
|
66
|
-
|
67
|
-
goto '/integration/attr?edit_mode=yes'
|
68
|
-
|
69
|
-
element(:id=>'whowishWordId0').attribute_value("title").should == "Some new word"
|
70
|
-
|
71
|
-
click 'whowishWordId0_____title'
|
72
|
-
element(:id=>'whowishWordId0').attribute_value("title").should == "Some new word"
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
it "edits an option" do
|
77
|
-
|
78
|
-
goto '/integration/select?edit_mode=yes'
|
79
|
-
sleep(1)
|
80
|
-
|
81
|
-
|
82
|
-
click 'whowishWordId0_____value'
|
83
|
-
|
84
|
-
fill "whowishWordDialogContent", "Some new value"
|
85
|
-
click "whowishWordDialogSaveButton"
|
86
|
-
|
87
|
-
value('whowishWordId0').should == "Some new value"
|
88
|
-
|
89
|
-
|
90
|
-
click 'whowishWordId0_____text'
|
91
|
-
|
92
|
-
fill "whowishWordDialogContent", "Some new text"
|
93
|
-
click "whowishWordDialogSaveButton"
|
94
|
-
|
95
|
-
execute_script('return $("#whowishWordId0").text();').should == "Some new text"
|
96
|
-
|
97
|
-
|
98
|
-
commit_database
|
99
|
-
|
100
|
-
goto '/integration/select?edit_mode=yes'
|
101
|
-
sleep(1)
|
102
|
-
|
103
|
-
value('whowishWordId0').should == "Some new value"
|
104
|
-
|
105
|
-
click 'whowishWordId0_____value'
|
106
|
-
value("whowishWordDialogContent").should == "Some new value"
|
107
|
-
click 'whowishWordDialogCloseButton'
|
108
|
-
|
109
|
-
execute_script('return $("#whowishWordId0").text();').should == "Some new text"
|
110
|
-
|
111
|
-
click 'whowishWordId0_____text'
|
112
|
-
value("whowishWordDialogContent").should == "Some new text"
|
113
|
-
click 'whowishWordDialogCloseButton'
|
114
|
-
|
115
|
-
end
|
116
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'WhowishWord workflow spec' do
|
4
|
+
|
5
|
+
it "edits a normal text" do
|
6
|
+
|
7
|
+
goto '/integration?edit_mode=yes'
|
8
|
+
sleep(1)
|
9
|
+
|
10
|
+
click 'whowishWordId0_____html'
|
11
|
+
|
12
|
+
fill "whowishWordDialogContent", "Some new word"
|
13
|
+
click "whowishWordDialogSaveButton"
|
14
|
+
|
15
|
+
html('whowishWordId0').should == "Some new word"
|
16
|
+
|
17
|
+
commit_database
|
18
|
+
|
19
|
+
goto '/integration?edit_mode=yes'
|
20
|
+
sleep(1)
|
21
|
+
|
22
|
+
html('whowishWordId0').should == "Some new word"
|
23
|
+
|
24
|
+
click 'whowishWordId0_____html'
|
25
|
+
value("whowishWordDialogContent").should == "Some new word"
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
it "edits a value" do
|
30
|
+
|
31
|
+
goto '/integration/value?edit_mode=yes'
|
32
|
+
sleep(1)
|
33
|
+
|
34
|
+
click 'whowishWordId0_____value'
|
35
|
+
|
36
|
+
fill "whowishWordDialogContent", "Some new word"
|
37
|
+
click "whowishWordDialogSaveButton"
|
38
|
+
|
39
|
+
value('whowishWordId0').should == "Some new word"
|
40
|
+
|
41
|
+
commit_database
|
42
|
+
|
43
|
+
goto '/integration/value?edit_mode=yes'
|
44
|
+
sleep(1)
|
45
|
+
|
46
|
+
value('whowishWordId0').should == "Some new word"
|
47
|
+
|
48
|
+
click 'whowishWordId0_____value'
|
49
|
+
value("whowishWordDialogContent").should == "Some new word"
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
it "edits an attribute" do
|
54
|
+
|
55
|
+
goto '/integration/attr?edit_mode=yes'
|
56
|
+
sleep(1)
|
57
|
+
|
58
|
+
click 'whowishWordId0_____title'
|
59
|
+
|
60
|
+
fill "whowishWordDialogContent", "Some new word"
|
61
|
+
click "whowishWordDialogSaveButton"
|
62
|
+
|
63
|
+
element(:id=>'whowishWordId0').attribute_value("title").should == "Some new word"
|
64
|
+
|
65
|
+
commit_database
|
66
|
+
|
67
|
+
goto '/integration/attr?edit_mode=yes'
|
68
|
+
|
69
|
+
element(:id=>'whowishWordId0').attribute_value("title").should == "Some new word"
|
70
|
+
|
71
|
+
click 'whowishWordId0_____title'
|
72
|
+
element(:id=>'whowishWordId0').attribute_value("title").should == "Some new word"
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
it "edits an option" do
|
77
|
+
|
78
|
+
goto '/integration/select?edit_mode=yes'
|
79
|
+
sleep(1)
|
80
|
+
|
81
|
+
|
82
|
+
click 'whowishWordId0_____value'
|
83
|
+
|
84
|
+
fill "whowishWordDialogContent", "Some new value"
|
85
|
+
click "whowishWordDialogSaveButton"
|
86
|
+
|
87
|
+
value('whowishWordId0').should == "Some new value"
|
88
|
+
|
89
|
+
|
90
|
+
click 'whowishWordId0_____text'
|
91
|
+
|
92
|
+
fill "whowishWordDialogContent", "Some new text"
|
93
|
+
click "whowishWordDialogSaveButton"
|
94
|
+
|
95
|
+
execute_script('return $("#whowishWordId0").text();').should == "Some new text"
|
96
|
+
|
97
|
+
|
98
|
+
commit_database
|
99
|
+
|
100
|
+
goto '/integration/select?edit_mode=yes'
|
101
|
+
sleep(1)
|
102
|
+
|
103
|
+
value('whowishWordId0').should == "Some new value"
|
104
|
+
|
105
|
+
click 'whowishWordId0_____value'
|
106
|
+
value("whowishWordDialogContent").should == "Some new value"
|
107
|
+
click 'whowishWordDialogCloseButton'
|
108
|
+
|
109
|
+
execute_script('return $("#whowishWordId0").text();').should == "Some new text"
|
110
|
+
|
111
|
+
click 'whowishWordId0_____text'
|
112
|
+
value("whowishWordDialogContent").should == "Some new text"
|
113
|
+
click 'whowishWordDialogCloseButton'
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
117
|
end
|
data/rails/spec/spec_helper.rb
CHANGED
@@ -1,36 +1,34 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'rubygems'
|
3
|
-
|
4
|
-
ENV["RAILS_ENV"] ||= 'test'
|
5
|
-
|
6
|
-
require File.expand_path("../../config/environment", __FILE__)
|
7
|
-
|
8
|
-
require 'rspec/rails'
|
9
|
-
|
10
|
-
require 'watir-webdriver-rails'
|
11
|
-
|
12
|
-
WatirWebdriverRails.host = "localhost"
|
13
|
-
WatirWebdriverRails.port = 57124
|
14
|
-
|
15
|
-
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f}
|
16
|
-
|
17
|
-
|
18
|
-
RSpec.configure do |config|
|
19
|
-
|
20
|
-
config.include Browser
|
21
|
-
config.include MongoidHelper
|
22
|
-
config.include JsonRspecHelper
|
23
|
-
|
24
|
-
config.before(:each) do
|
25
|
-
|
26
|
-
WhowishWordHtml.delete_all
|
27
|
-
WhowishWord.words = {}
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
ENV["RAILS_ENV"] ||= 'test'
|
5
|
+
|
6
|
+
require File.expand_path("../../config/environment", __FILE__)
|
7
|
+
|
8
|
+
require 'rspec/rails'
|
9
|
+
|
10
|
+
require 'watir-webdriver-rails'
|
11
|
+
|
12
|
+
WatirWebdriverRails.host = "localhost"
|
13
|
+
WatirWebdriverRails.port = 57124
|
14
|
+
|
15
|
+
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f}
|
16
|
+
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
|
20
|
+
config.include Browser
|
21
|
+
config.include MongoidHelper
|
22
|
+
config.include JsonRspecHelper
|
23
|
+
|
24
|
+
config.before(:each) do
|
25
|
+
|
26
|
+
WhowishWordHtml.delete_all
|
27
|
+
WhowishWord.words = {}
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
|