editorial_logic 1.1.5 → 1.1.6
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/Gemfile +1 -1
- data/VERSION +1 -1
- data/app/models/managed_content.rb +1 -4
- data/app/views/admin/managed_contents/_article_fields.html.erb +1 -1
- data/app/views/admin/managed_contents/_faq_fields.html.erb +2 -2
- data/app/views/admin/managed_contents/_faq_index.html.erb +1 -1
- data/app/views/admin/managed_contents/_term_fields.html.erb +2 -2
- data/app/views/admin/sections/_index.html.erb +1 -1
- data/app/views/layouts/application.html.erb +0 -6
- data/config/environments/development.rb +1 -1
- data/editorial_logic.gemspec +6 -6
- data/features/step_definitions/web_steps.rb +82 -90
- data/features/support/env.rb +37 -18
- data/features/support/paths.rb +3 -3
- data/features/support/selectors.rb +39 -0
- data/lib/editorial_logic.rb +0 -3
- data/lib/tasks/cucumber.rake +14 -9
- data/spec/support/be_valid_asset.rb +1 -1
- metadata +6 -6
- data/public/javascripts/application.js +0 -2
data/Gemfile
CHANGED
@@ -2,7 +2,7 @@ source 'http://rubygems.org'
|
|
2
2
|
source 'http://jose.seologic.com:8808/'
|
3
3
|
|
4
4
|
gem 'bson_ext'
|
5
|
-
gem 'carrierwave'
|
5
|
+
gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
|
6
6
|
gem 'ckeditor', :git => 'git://github.com/Bantik/rails-ckeditor.git', :branch => 'rails3_mongoid'
|
7
7
|
gem 'fastercsv'
|
8
8
|
gem 'mongoid'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.6
|
@@ -1,13 +1,10 @@
|
|
1
|
-
require 'carrierwave/orm/mongoid'
|
2
|
-
|
3
1
|
class ManagedContent
|
4
|
-
|
5
2
|
include EditorialLogic::Base
|
6
3
|
include Mongoid::Document
|
7
4
|
include Mongoid::Timestamps
|
8
5
|
|
9
6
|
store_in :documents
|
10
|
-
mount_uploader :document, DocumentUploader
|
7
|
+
mount_uploader :document, DocumentUploader, :mount_on => :document_filename
|
11
8
|
|
12
9
|
# Mongo Config ===================================================================================
|
13
10
|
|
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
<fieldset class="form_container" id="references_section">
|
40
40
|
<%= legend_tag 'References', :help => 'Add information about any external references that are related to this content.' -%>
|
41
|
-
<%= f.cktext_area :references, :toolbar => '
|
41
|
+
<%= f.cktext_area :references, :toolbar => 'Full', :width => '900px'-%>
|
42
42
|
</fieldset>
|
43
43
|
|
44
44
|
<%- if @publication.managed_contents.count > 1 -%>
|
@@ -13,8 +13,8 @@
|
|
13
13
|
</div>
|
14
14
|
<br style="clear: both;" />
|
15
15
|
<%= f.label 'Answer', :for => :content -%>
|
16
|
-
<%= f.cktext_area :content, :toolbar => '
|
16
|
+
<%= f.cktext_area :content, :toolbar => 'Full', :width => '900px' -%>
|
17
17
|
<br style="clear: both;" />
|
18
18
|
<%= f.label 'References', :for => :references -%>
|
19
|
-
<%= f.cktext_area :references, :toolbar => '
|
19
|
+
<%= f.cktext_area :references, :toolbar => 'Full', :width => '900px' -%>
|
20
20
|
</fieldset>
|
@@ -35,5 +35,5 @@
|
|
35
35
|
</tbody>
|
36
36
|
</table>
|
37
37
|
|
38
|
-
<%= sortable_element 'content_list', :update => nil, :url => admin_publication_reorder_managed_contents_path(@publication), :method => :put, :tag => 'tr' -%>
|
38
|
+
<%= sortable_element 'content_list', :update => nil, :url => admin_publication_reorder_managed_contents_path(@publication), :method => :put, :tag => 'tr' unless Rails.env.test? -%>
|
39
39
|
<%- end -%>
|
@@ -9,12 +9,12 @@
|
|
9
9
|
</div>
|
10
10
|
<br style="clear: both;" />
|
11
11
|
<label>Definition</label><br />
|
12
|
-
<%= f.cktext_area :content, :toolbar => '
|
12
|
+
<%= f.cktext_area :content, :toolbar => 'Full', :width => '900px' -%>
|
13
13
|
</fieldset>
|
14
14
|
|
15
15
|
<fieldset class="form_container">
|
16
16
|
<%= legend_tag 'References' -%>
|
17
|
-
<%= f.cktext_area :references, :toolbar => '
|
17
|
+
<%= f.cktext_area :references, :toolbar => 'Full', :width => '900px' -%>
|
18
18
|
</fieldset>
|
19
19
|
|
20
20
|
<fieldset class="form_container">
|
@@ -32,6 +32,6 @@
|
|
32
32
|
</tbody>
|
33
33
|
</table>
|
34
34
|
|
35
|
-
<%= sortable_element 'content_list', :update => nil, :url => admin_publication_managed_content_reorder_sections_path(@publication, @managed_content), :method => :put, :tag => 'tr' -%>
|
35
|
+
<%= sortable_element 'content_list', :update => nil, :url => admin_publication_managed_content_reorder_sections_path(@publication, @managed_content), :method => :put, :tag => 'tr' unless Rails.env.test? -%>
|
36
36
|
|
37
37
|
<%- end -%>
|
@@ -28,12 +28,6 @@
|
|
28
28
|
<%- flash.each do |name, msg| -%>
|
29
29
|
<%- if name == :notice -%>
|
30
30
|
<%= content_tag :div, msg, :id => "flash_#{name}", :class => "flash_#{name}", :style => "display:none;" -%>
|
31
|
-
<script type="text/javascript">
|
32
|
-
$('washout').toggle();
|
33
|
-
$('flash_notice').toggle();
|
34
|
-
<%= visual_effect(:fade, 'flash_notice', :duration => 1.0, :delay => 1.0).html_safe -%>
|
35
|
-
<%= visual_effect(:fade, 'washout', :duration => 1.0, :delay => 1.0).html_safe -%>
|
36
|
-
</script>
|
37
31
|
<%- else -%>
|
38
32
|
<%= content_tag :div, msg, :id => "flash_#{name}", :class => "flash_#{name}" -%>
|
39
33
|
<%- end -%>
|
@@ -11,7 +11,7 @@ EditorialLogic::Application.configure do
|
|
11
11
|
|
12
12
|
# Show full error reports and disable caching
|
13
13
|
config.consider_all_requests_local = true
|
14
|
-
|
14
|
+
# config.action_view.debug_rjs = true
|
15
15
|
config.action_controller.perform_caching = false
|
16
16
|
|
17
17
|
# Don't care if the mailer can't send
|
data/editorial_logic.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{editorial_logic}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bantik"]
|
12
|
-
s.date = %q{2011-08-
|
12
|
+
s.date = %q{2011-08-31}
|
13
13
|
s.description = %q{An engine for enabling managed content, including articles, blogs, FAQs and glossaries.}
|
14
14
|
s.email = %q{corey@seologic.com}
|
15
15
|
s.files = [
|
@@ -96,6 +96,7 @@ Gem::Specification.new do |s|
|
|
96
96
|
"features/support/env.rb",
|
97
97
|
"features/support/hooks.rb",
|
98
98
|
"features/support/paths.rb",
|
99
|
+
"features/support/selectors.rb",
|
99
100
|
"init.rb",
|
100
101
|
"lib/editorial_logic.rb",
|
101
102
|
"lib/editorial_logic/engine.rb",
|
@@ -146,7 +147,6 @@ Gem::Specification.new do |s|
|
|
146
147
|
"public/images/layout/th_bg.png",
|
147
148
|
"public/images/layout/th_bg_selected.png",
|
148
149
|
"public/index.html",
|
149
|
-
"public/javascripts/application.js",
|
150
150
|
"public/javascripts/ckeditor/.htaccess",
|
151
151
|
"public/javascripts/ckeditor/CHANGES.html",
|
152
152
|
"public/javascripts/ckeditor/INSTALL.html",
|
@@ -820,7 +820,7 @@ Gem::Specification.new do |s|
|
|
820
820
|
|
821
821
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
822
822
|
s.add_runtime_dependency(%q<bson_ext>, [">= 0"])
|
823
|
-
s.add_runtime_dependency(%q<carrierwave>, [">= 0"])
|
823
|
+
s.add_runtime_dependency(%q<carrierwave-mongoid>, [">= 0"])
|
824
824
|
s.add_runtime_dependency(%q<ckeditor>, [">= 0"])
|
825
825
|
s.add_runtime_dependency(%q<fastercsv>, [">= 0"])
|
826
826
|
s.add_runtime_dependency(%q<mongoid>, [">= 0"])
|
@@ -831,7 +831,7 @@ Gem::Specification.new do |s|
|
|
831
831
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
832
832
|
else
|
833
833
|
s.add_dependency(%q<bson_ext>, [">= 0"])
|
834
|
-
s.add_dependency(%q<carrierwave>, [">= 0"])
|
834
|
+
s.add_dependency(%q<carrierwave-mongoid>, [">= 0"])
|
835
835
|
s.add_dependency(%q<ckeditor>, [">= 0"])
|
836
836
|
s.add_dependency(%q<fastercsv>, [">= 0"])
|
837
837
|
s.add_dependency(%q<mongoid>, [">= 0"])
|
@@ -843,7 +843,7 @@ Gem::Specification.new do |s|
|
|
843
843
|
end
|
844
844
|
else
|
845
845
|
s.add_dependency(%q<bson_ext>, [">= 0"])
|
846
|
-
s.add_dependency(%q<carrierwave>, [">= 0"])
|
846
|
+
s.add_dependency(%q<carrierwave-mongoid>, [">= 0"])
|
847
847
|
s.add_dependency(%q<ckeditor>, [">= 0"])
|
848
848
|
s.add_dependency(%q<fastercsv>, [">= 0"])
|
849
849
|
s.add_dependency(%q<mongoid>, [">= 0"])
|
@@ -1,21 +1,46 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
1
|
+
# TL;DR: YOU SHOULD DELETE THIS FILE
|
2
|
+
#
|
3
|
+
# This file was generated by Cucumber-Rails and is only here to get you a head start
|
4
|
+
# These step definitions are thin wrappers around the Capybara/Webrat API that lets you
|
5
|
+
# visit pages, interact with widgets and make assertions about page content.
|
6
|
+
#
|
7
|
+
# If you use these step definitions as basis for your features you will quickly end up
|
8
|
+
# with features that are:
|
9
|
+
#
|
10
|
+
# * Hard to maintain
|
11
|
+
# * Verbose to read
|
12
|
+
#
|
13
|
+
# A much better approach is to write your own higher level step definitions, following
|
14
|
+
# the advice in the following blog posts:
|
15
|
+
#
|
16
|
+
# * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html
|
17
|
+
# * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/
|
18
|
+
# * http://elabs.se/blog/15-you-re-cuking-it-wrong
|
19
|
+
#
|
6
20
|
|
7
21
|
|
8
22
|
require 'uri'
|
9
23
|
require 'cgi'
|
10
24
|
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
25
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors"))
|
11
26
|
|
12
27
|
module WithinHelpers
|
13
28
|
def with_scope(locator)
|
14
|
-
locator ? within(locator) { yield } : yield
|
29
|
+
locator ? within(*selector_for(locator)) { yield } : yield
|
15
30
|
end
|
16
31
|
end
|
17
32
|
World(WithinHelpers)
|
18
33
|
|
34
|
+
# Single-line step scoper
|
35
|
+
When /^(.*) within (.*[^:])$/ do |step, parent|
|
36
|
+
with_scope(parent) { When step }
|
37
|
+
end
|
38
|
+
|
39
|
+
# Multi-line step scoper
|
40
|
+
When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string|
|
41
|
+
with_scope(parent) { When "#{step}:", table_or_string }
|
42
|
+
end
|
43
|
+
|
19
44
|
Given /^(?:|I )am on (.+)$/ do |page_name|
|
20
45
|
visit path_to(page_name)
|
21
46
|
end
|
@@ -24,28 +49,20 @@ When /^(?:|I )go to (.+)$/ do |page_name|
|
|
24
49
|
visit path_to(page_name)
|
25
50
|
end
|
26
51
|
|
27
|
-
When /^(?:|I )press "([^"]*)"
|
28
|
-
|
29
|
-
click_button(button)
|
30
|
-
end
|
52
|
+
When /^(?:|I )press "([^"]*)"$/ do |button|
|
53
|
+
click_button(button)
|
31
54
|
end
|
32
55
|
|
33
|
-
When /^(?:|I )follow "([^"]*)"
|
34
|
-
|
35
|
-
click_link(link)
|
36
|
-
end
|
56
|
+
When /^(?:|I )follow "([^"]*)"$/ do |link|
|
57
|
+
click_link(link)
|
37
58
|
end
|
38
59
|
|
39
|
-
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"
|
40
|
-
|
41
|
-
fill_in(field, :with => value)
|
42
|
-
end
|
60
|
+
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
|
61
|
+
fill_in(field, :with => value)
|
43
62
|
end
|
44
63
|
|
45
|
-
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"
|
46
|
-
|
47
|
-
fill_in(field, :with => value)
|
48
|
-
end
|
64
|
+
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field|
|
65
|
+
fill_in(field, :with => value)
|
49
66
|
end
|
50
67
|
|
51
68
|
# Use this to fill in an entire form with data from a table. Example:
|
@@ -59,95 +76,70 @@ end
|
|
59
76
|
# TODO: Add support for checkbox, select og option
|
60
77
|
# based on naming conventions.
|
61
78
|
#
|
62
|
-
When /^(?:|I )fill in the following
|
63
|
-
|
64
|
-
|
65
|
-
When %{I fill in "#{name}" with "#{value}"}
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
71
|
-
with_scope(selector) do
|
72
|
-
select(value, :from => field)
|
79
|
+
When /^(?:|I )fill in the following:$/ do |fields|
|
80
|
+
fields.rows_hash.each do |name, value|
|
81
|
+
When %{I fill in "#{name}" with "#{value}"}
|
73
82
|
end
|
74
83
|
end
|
75
84
|
|
76
|
-
When /^(?:|I )
|
77
|
-
|
78
|
-
check(field)
|
79
|
-
end
|
85
|
+
When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field|
|
86
|
+
select(value, :from => field)
|
80
87
|
end
|
81
88
|
|
82
|
-
When /^(?:|I )
|
83
|
-
|
84
|
-
uncheck(field)
|
85
|
-
end
|
89
|
+
When /^(?:|I )check "([^"]*)"$/ do |field|
|
90
|
+
check(field)
|
86
91
|
end
|
87
92
|
|
88
|
-
When /^(?:|I )
|
89
|
-
|
90
|
-
choose(field)
|
91
|
-
end
|
93
|
+
When /^(?:|I )uncheck "([^"]*)"$/ do |field|
|
94
|
+
uncheck(field)
|
92
95
|
end
|
93
96
|
|
94
|
-
When /^(?:|I )
|
95
|
-
|
96
|
-
attach_file(field, path)
|
97
|
-
end
|
97
|
+
When /^(?:|I )choose "([^"]*)"$/ do |field|
|
98
|
+
choose(field)
|
98
99
|
end
|
99
100
|
|
100
|
-
|
101
|
-
|
102
|
-
expected = JSON.pretty_generate(JSON.parse(expected_json))
|
103
|
-
actual = JSON.pretty_generate(JSON.parse(response.body))
|
104
|
-
expected.should == actual
|
101
|
+
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
|
102
|
+
attach_file(field, File.expand_path(path))
|
105
103
|
end
|
106
104
|
|
107
|
-
Then /^(?:|I )should see "([^"]*)"
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
assert page.has_content?(text)
|
113
|
-
end
|
105
|
+
Then /^(?:|I )should see "([^"]*)"$/ do |text|
|
106
|
+
if page.respond_to? :should
|
107
|
+
page.should have_content(text)
|
108
|
+
else
|
109
|
+
assert page.has_content?(text)
|
114
110
|
end
|
115
111
|
end
|
116
112
|
|
117
|
-
Then /^(?:|I )should see \/([^\/]*)
|
113
|
+
Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp|
|
118
114
|
regexp = Regexp.new(regexp)
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
end
|
115
|
+
|
116
|
+
if page.respond_to? :should
|
117
|
+
page.should have_xpath('//*', :text => regexp)
|
118
|
+
else
|
119
|
+
assert page.has_xpath?('//*', :text => regexp)
|
125
120
|
end
|
126
121
|
end
|
127
122
|
|
128
|
-
Then /^(?:|I )should not see "([^"]*)"
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
assert page.has_no_content?(text)
|
134
|
-
end
|
123
|
+
Then /^(?:|I )should not see "([^"]*)"$/ do |text|
|
124
|
+
if page.respond_to? :should
|
125
|
+
page.should have_no_content(text)
|
126
|
+
else
|
127
|
+
assert page.has_no_content?(text)
|
135
128
|
end
|
136
129
|
end
|
137
130
|
|
138
|
-
Then /^(?:|I )should not see \/([^\/]*)
|
131
|
+
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
|
139
132
|
regexp = Regexp.new(regexp)
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
end
|
133
|
+
|
134
|
+
if page.respond_to? :should
|
135
|
+
page.should have_no_xpath('//*', :text => regexp)
|
136
|
+
else
|
137
|
+
assert page.has_no_xpath?('//*', :text => regexp)
|
146
138
|
end
|
147
139
|
end
|
148
140
|
|
149
|
-
Then /^the "([^"]*)" field(?: within
|
150
|
-
with_scope(
|
141
|
+
Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value|
|
142
|
+
with_scope(parent) do
|
151
143
|
field = find_field(field)
|
152
144
|
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
153
145
|
if field_value.respond_to? :should
|
@@ -158,8 +150,8 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |
|
|
158
150
|
end
|
159
151
|
end
|
160
152
|
|
161
|
-
Then /^the "([^"]*)" field(?: within
|
162
|
-
with_scope(
|
153
|
+
Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value|
|
154
|
+
with_scope(parent) do
|
163
155
|
field = find_field(field)
|
164
156
|
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
165
157
|
if field_value.respond_to? :should_not
|
@@ -170,8 +162,8 @@ Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/
|
|
170
162
|
end
|
171
163
|
end
|
172
164
|
|
173
|
-
Then /^the "([^"]*)" checkbox(?: within
|
174
|
-
with_scope(
|
165
|
+
Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent|
|
166
|
+
with_scope(parent) do
|
175
167
|
field_checked = find_field(label)['checked']
|
176
168
|
if field_checked.respond_to? :should
|
177
169
|
field_checked.should be_true
|
@@ -181,8 +173,8 @@ Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |labe
|
|
181
173
|
end
|
182
174
|
end
|
183
175
|
|
184
|
-
Then /^the "([^"]*)" checkbox(?: within
|
185
|
-
with_scope(
|
176
|
+
Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent|
|
177
|
+
with_scope(parent) do
|
186
178
|
field_checked = find_field(label)['checked']
|
187
179
|
if field_checked.respond_to? :should
|
188
180
|
field_checked.should be_false
|
data/features/support/env.rb
CHANGED
@@ -4,28 +4,47 @@
|
|
4
4
|
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
5
|
# files.
|
6
6
|
|
7
|
-
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
9
|
-
|
10
|
-
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
|
11
|
-
require 'cucumber/rails/rspec'
|
12
|
-
require 'cucumber/rails/world'
|
13
|
-
require 'cucumber/web/tableish'
|
14
|
-
require 'capybara/rails'
|
15
|
-
require 'capybara/cucumber'
|
16
|
-
require 'capybara/session'
|
17
|
-
require 'be_valid_asset'
|
18
|
-
require 'mongoid'
|
19
|
-
require 'database_cleaner'
|
20
|
-
require 'database_cleaner/cucumber'
|
7
|
+
require 'cucumber/rails'
|
21
8
|
|
22
9
|
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
23
10
|
# order to ease the transition to Capybara we set the default here. If you'd
|
24
11
|
# prefer to use XPath just remove this line and adjust any selectors in your
|
25
12
|
# steps to use the XPath syntax.
|
26
13
|
Capybara.default_selector = :css
|
27
|
-
Capybara.save_and_open_page_path = Rails.root + 'tmp'
|
28
14
|
|
29
|
-
#
|
30
|
-
#
|
31
|
-
|
15
|
+
# By default, any exception happening in your Rails application will bubble up
|
16
|
+
# to Cucumber so that your scenario will fail. This is a different from how
|
17
|
+
# your application behaves in the production environment, where an error page will
|
18
|
+
# be rendered instead.
|
19
|
+
#
|
20
|
+
# Sometimes we want to override this default behaviour and allow Rails to rescue
|
21
|
+
# exceptions and display an error page (just like when the app is running in production).
|
22
|
+
# Typical scenarios where you want to do this is when you test your error pages.
|
23
|
+
# There are two ways to allow Rails to rescue exceptions:
|
24
|
+
#
|
25
|
+
# 1) Tag your scenario (or feature) with @allow-rescue
|
26
|
+
#
|
27
|
+
# 2) Set the value below to true. Beware that doing this globally is not
|
28
|
+
# recommended as it will mask a lot of errors for you!
|
29
|
+
#
|
30
|
+
ActionController::Base.allow_rescue = false
|
31
|
+
|
32
|
+
# Remove/comment out the lines below if your app doesn't have a database.
|
33
|
+
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
|
34
|
+
begin
|
35
|
+
DatabaseCleaner.strategy = :truncation
|
36
|
+
rescue NameError
|
37
|
+
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
38
|
+
end
|
39
|
+
|
40
|
+
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
|
41
|
+
# See the DatabaseCleaner documentation for details. Example:
|
42
|
+
#
|
43
|
+
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
|
44
|
+
# DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
|
48
|
+
# DatabaseCleaner.strategy = :transaction
|
49
|
+
# end
|
50
|
+
#
|
data/features/support/paths.rb
CHANGED
@@ -8,7 +8,7 @@ module NavigationHelpers
|
|
8
8
|
def path_to(page_name)
|
9
9
|
case page_name
|
10
10
|
|
11
|
-
when
|
11
|
+
when /^the home\s?page$/
|
12
12
|
'/'
|
13
13
|
|
14
14
|
# Add more mappings here.
|
@@ -19,10 +19,10 @@ module NavigationHelpers
|
|
19
19
|
|
20
20
|
else
|
21
21
|
begin
|
22
|
-
page_name =~
|
22
|
+
page_name =~ /^the (.*) page$/
|
23
23
|
path_components = $1.split(/\s+/)
|
24
24
|
self.send(path_components.push('path').join('_').to_sym)
|
25
|
-
rescue
|
25
|
+
rescue NoMethodError, ArgumentError
|
26
26
|
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
27
27
|
"Now, go and add a mapping in #{__FILE__}"
|
28
28
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module HtmlSelectorsHelpers
|
2
|
+
# Maps a name to a selector. Used primarily by the
|
3
|
+
#
|
4
|
+
# When /^(.+) within (.+)$/ do |step, scope|
|
5
|
+
#
|
6
|
+
# step definitions in web_steps.rb
|
7
|
+
#
|
8
|
+
def selector_for(locator)
|
9
|
+
case locator
|
10
|
+
|
11
|
+
when "the page"
|
12
|
+
"html > body"
|
13
|
+
|
14
|
+
# Add more mappings here.
|
15
|
+
# Here is an example that pulls values out of the Regexp:
|
16
|
+
#
|
17
|
+
# when /^the (notice|error|info) flash$/
|
18
|
+
# ".flash.#{$1}"
|
19
|
+
|
20
|
+
# You can also return an array to use a different selector
|
21
|
+
# type, like:
|
22
|
+
#
|
23
|
+
# when /the header/
|
24
|
+
# [:xpath, "//header"]
|
25
|
+
|
26
|
+
# This allows you to provide a quoted selector as the scope
|
27
|
+
# for "within" steps as was previously the default for the
|
28
|
+
# web steps:
|
29
|
+
when /^"(.+)"$/
|
30
|
+
$1
|
31
|
+
|
32
|
+
else
|
33
|
+
raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
|
34
|
+
"Now, go and add a mapping in #{__FILE__}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
World(HtmlSelectorsHelpers)
|
data/lib/editorial_logic.rb
CHANGED
data/lib/tasks/cucumber.rake
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
4
|
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
5
|
# files.
|
6
6
|
|
@@ -32,15 +32,14 @@ begin
|
|
32
32
|
t.profile = 'rerun'
|
33
33
|
end
|
34
34
|
|
35
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
36
|
-
t.cucumber_opts = "--format pretty"
|
37
|
-
t.rcov = true
|
38
|
-
end
|
39
|
-
|
40
|
-
task :features => 'db:test:prepare'
|
41
|
-
|
42
35
|
desc 'Run all features'
|
43
36
|
task :all => [:ok, :wip]
|
37
|
+
|
38
|
+
task :statsetup do
|
39
|
+
require 'rails/code_statistics'
|
40
|
+
::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
|
41
|
+
::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
|
42
|
+
end
|
44
43
|
end
|
45
44
|
desc 'Alias for cucumber:ok'
|
46
45
|
task :cucumber => 'cucumber:ok'
|
@@ -50,6 +49,12 @@ begin
|
|
50
49
|
task :features => :cucumber do
|
51
50
|
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
52
51
|
end
|
52
|
+
|
53
|
+
# In case we don't have ActiveRecord, append a no-op task that we can depend upon.
|
54
|
+
task 'db:test:prepare' do
|
55
|
+
end
|
56
|
+
|
57
|
+
task :stats => 'cucumber:statsetup'
|
53
58
|
rescue LoadError
|
54
59
|
desc 'cucumber rake task not available (cucumber not installed)'
|
55
60
|
task :cucumber do
|
@@ -2,4 +2,4 @@ include BeValidAsset
|
|
2
2
|
|
3
3
|
# BeValidAsset::Configuration.display_invalid_content = true
|
4
4
|
BeValidAsset::Configuration.enable_caching = true
|
5
|
-
BeValidAsset::Configuration.cache_path = File.join(
|
5
|
+
BeValidAsset::Configuration.cache_path = File.join(Rails.root, %w(tmp be_valid_asset_cache))
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: editorial_logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 6
|
10
|
+
version: 1.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bantik
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-31 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name: carrierwave
|
36
|
+
name: carrierwave-mongoid
|
37
37
|
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
@@ -254,6 +254,7 @@ files:
|
|
254
254
|
- features/support/env.rb
|
255
255
|
- features/support/hooks.rb
|
256
256
|
- features/support/paths.rb
|
257
|
+
- features/support/selectors.rb
|
257
258
|
- init.rb
|
258
259
|
- lib/editorial_logic.rb
|
259
260
|
- lib/editorial_logic/engine.rb
|
@@ -304,7 +305,6 @@ files:
|
|
304
305
|
- public/images/layout/th_bg.png
|
305
306
|
- public/images/layout/th_bg_selected.png
|
306
307
|
- public/index.html
|
307
|
-
- public/javascripts/application.js
|
308
308
|
- public/javascripts/ckeditor/.htaccess
|
309
309
|
- public/javascripts/ckeditor/CHANGES.html
|
310
310
|
- public/javascripts/ckeditor/INSTALL.html
|