bcms_support 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.markdown +7 -0
- data/Rakefile +45 -0
- data/lib/bcms_support.rb +1 -0
- data/lib/bcms_support/cucumber.rb +23 -0
- data/lib/bcms_support/shared.rb +27 -0
- data/lib/bcms_support/test.rb +11 -0
- data/seeds/connectors.yml +31 -0
- data/seeds/content_type_groups.yml +9 -0
- data/seeds/content_types.yml +43 -0
- data/seeds/group_permissions.yml +10 -0
- data/seeds/group_sections.yml +19 -0
- data/seeds/group_type_permissions.yml +7 -0
- data/seeds/group_types.yml +19 -0
- data/seeds/groups.yml +19 -0
- data/seeds/html_block_versions.yml +40 -0
- data/seeds/html_blocks.yml +37 -0
- data/seeds/page_versions.yml +113 -0
- data/seeds/pages.yml +77 -0
- data/seeds/permissions.yml +22 -0
- data/seeds/section_nodes.yml +36 -0
- data/seeds/sections.yml +15 -0
- data/seeds/sites.yml +7 -0
- data/seeds/user_group_memberships.yml +7 -0
- data/seeds/users.yml +13 -0
- data/spec/bcms_models.rb +16 -0
- data/spec/bcms_schema.rb +195 -0
- data/spec/bcms_support_spec/cucumber_spec.rb +6 -0
- data/spec/bcms_support_spec/shared_spec.rb +89 -0
- data/spec/bcms_support_spec/test_spec.rb +6 -0
- data/spec/spec_helper.rb +8 -0
- metadata +116 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Juan Alvarez
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
begin
|
6
|
+
require 'spec/rake/spectask'
|
7
|
+
rescue LoadError
|
8
|
+
puts "Rspec is not available. Itstall with sudo gem install rspec"
|
9
|
+
end
|
10
|
+
require 'jeweler'
|
11
|
+
|
12
|
+
Jeweler::Tasks.new do |gem|
|
13
|
+
gem.name = "bcms_support"
|
14
|
+
gem.summary = %Q{Support for testing BrowserCMS modules}
|
15
|
+
gem.description = %Q{Support for testing BrowserCMS modules}
|
16
|
+
gem.email = "alce@mac.com"
|
17
|
+
gem.homepage = "http://github.com/alce/bcms_test_support"
|
18
|
+
gem.authors = ["Juan Alvarez"]
|
19
|
+
gem.files = %w[LICENCE README.markdown Rakefile] + Dir.glob("{rails,lib,spec,seeds}/**/*")
|
20
|
+
gem.add_development_dependency 'rspec'
|
21
|
+
end
|
22
|
+
Jeweler::GemcutterTasks.new
|
23
|
+
rescue LoadError
|
24
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Default: run unit specs'
|
28
|
+
task :default => :spec
|
29
|
+
|
30
|
+
if defined? Spec
|
31
|
+
desc 'Test bcms test support gem'
|
32
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
33
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
34
|
+
t.spec_opts = ["-c"]
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Test bcms test support gem'
|
38
|
+
Spec::Rake::SpecTask.new('specdoc') do |t|
|
39
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
40
|
+
t.spec_opts = ["--format specdoc", "-c"]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
data/lib/bcms_support.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'bcms_support', 'test')
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'shared')
|
2
|
+
|
3
|
+
module BcmsSupport
|
4
|
+
module Cucumber
|
5
|
+
include BcmsSupport::Shared
|
6
|
+
|
7
|
+
def login_as(user)
|
8
|
+
@current_user = User.current = user
|
9
|
+
cookies[:fake_user_id] = @current_user.id
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
if defined? ApplicationController
|
15
|
+
class ApplicationController < ActionController::Base
|
16
|
+
prepend_before_filter :fake_current_user
|
17
|
+
def fake_current_user
|
18
|
+
session[:user_id] = cookies[:fake_user_id] if cookies[:fake_user_id]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
World(BcmsSupport::Cucumber) if defined? World
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module BcmsSupport
|
2
|
+
module Shared
|
3
|
+
|
4
|
+
TABLES_WITH_SEED_DATA = %w[connectors content_type_groups content_types group_permissions group_sections
|
5
|
+
group_type_permissions group_types groups html_block_versions html_blocks pages
|
6
|
+
page_versions permissions section_nodes sections sites user_group_memberships
|
7
|
+
users]
|
8
|
+
|
9
|
+
SEEDS_PATH = File.join(File.dirname(__FILE__), '..','..','seeds')
|
10
|
+
|
11
|
+
def publish_all_pages
|
12
|
+
Page.all.each(&:publish)
|
13
|
+
end
|
14
|
+
|
15
|
+
def seed_bcms_data
|
16
|
+
TABLES_WITH_SEED_DATA.each do |t|
|
17
|
+
ActiveRecord::Base.transaction do
|
18
|
+
YAML.load_file(SEEDS_PATH + "/#{t}.yml").each do |f|
|
19
|
+
sql = "INSERT INTO #{t} (#{f.keys.join(",")})"
|
20
|
+
sql << "VALUES (#{f.values.map { |v| ActiveRecord::Base.connection.quote(v) }.join(",")})"
|
21
|
+
ActiveRecord::Base.connection.execute(sql)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
- position: 1
|
3
|
+
connectable_id: 1
|
4
|
+
created_at: 2010-07-08 02:46:26 Z
|
5
|
+
updated_at: 2010-07-08 02:46:26 Z
|
6
|
+
container: main
|
7
|
+
page_id: 2
|
8
|
+
id: 1
|
9
|
+
connectable_version: 1
|
10
|
+
page_version: 2
|
11
|
+
connectable_type: HtmlBlock
|
12
|
+
- position: 1
|
13
|
+
connectable_id: 2
|
14
|
+
created_at: 2010-07-08 02:46:26 Z
|
15
|
+
updated_at: 2010-07-08 02:46:26 Z
|
16
|
+
container: main
|
17
|
+
page_id: 3
|
18
|
+
id: 2
|
19
|
+
connectable_version: 1
|
20
|
+
page_version: 2
|
21
|
+
connectable_type: HtmlBlock
|
22
|
+
- position: 1
|
23
|
+
connectable_id: 3
|
24
|
+
created_at: 2010-07-08 02:46:26 Z
|
25
|
+
updated_at: 2010-07-08 02:46:26 Z
|
26
|
+
container: main
|
27
|
+
page_id: 4
|
28
|
+
id: 3
|
29
|
+
connectable_version: 1
|
30
|
+
page_version: 2
|
31
|
+
connectable_type: HtmlBlock
|
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
- name: CategoryType
|
3
|
+
created_at: 2010-07-08 02:46:21 Z
|
4
|
+
updated_at: 2010-07-08 02:46:21 Z
|
5
|
+
priority: 2
|
6
|
+
id: 1
|
7
|
+
content_type_group_id: 2
|
8
|
+
- name: Category
|
9
|
+
created_at: 2010-07-08 02:46:21 Z
|
10
|
+
updated_at: 2010-07-08 02:46:21 Z
|
11
|
+
priority: 2
|
12
|
+
id: 2
|
13
|
+
content_type_group_id: 2
|
14
|
+
- name: HtmlBlock
|
15
|
+
created_at: 2010-07-08 02:46:21 Z
|
16
|
+
updated_at: 2010-07-08 02:46:21 Z
|
17
|
+
priority: 1
|
18
|
+
id: 3
|
19
|
+
content_type_group_id: 1
|
20
|
+
- name: Portlet
|
21
|
+
created_at: 2010-07-08 02:46:22 Z
|
22
|
+
updated_at: 2010-07-08 02:46:22 Z
|
23
|
+
priority: 1
|
24
|
+
id: 4
|
25
|
+
content_type_group_id: 1
|
26
|
+
- name: FileBlock
|
27
|
+
created_at: 2010-07-08 02:46:22 Z
|
28
|
+
updated_at: 2010-07-08 02:46:22 Z
|
29
|
+
priority: 2
|
30
|
+
id: 5
|
31
|
+
content_type_group_id: 1
|
32
|
+
- name: ImageBlock
|
33
|
+
created_at: 2010-07-08 02:46:22 Z
|
34
|
+
updated_at: 2010-07-08 02:46:22 Z
|
35
|
+
priority: 2
|
36
|
+
id: 6
|
37
|
+
content_type_group_id: 1
|
38
|
+
- name: Tag
|
39
|
+
created_at: 2010-07-08 02:46:24 Z
|
40
|
+
updated_at: 2010-07-08 02:46:24 Z
|
41
|
+
priority: 2
|
42
|
+
id: 7
|
43
|
+
content_type_group_id: 2
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
- section_id: 1
|
3
|
+
id: 1
|
4
|
+
group_id: 1
|
5
|
+
- section_id: 2
|
6
|
+
id: 2
|
7
|
+
group_id: 1
|
8
|
+
- section_id: 1
|
9
|
+
id: 3
|
10
|
+
group_id: 2
|
11
|
+
- section_id: 2
|
12
|
+
id: 4
|
13
|
+
group_id: 2
|
14
|
+
- section_id: 1
|
15
|
+
id: 5
|
16
|
+
group_id: 3
|
17
|
+
- section_id: 2
|
18
|
+
id: 6
|
19
|
+
group_id: 3
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
- name: Guest
|
3
|
+
created_at: 2010-07-08 02:46:25 Z
|
4
|
+
updated_at: 2010-07-08 02:46:25 Z
|
5
|
+
cms_access: false
|
6
|
+
id: 1
|
7
|
+
guest: true
|
8
|
+
- name: Registered Public User
|
9
|
+
created_at: 2010-07-08 02:46:25 Z
|
10
|
+
updated_at: 2010-07-08 02:46:25 Z
|
11
|
+
cms_access: false
|
12
|
+
id: 2
|
13
|
+
guest: false
|
14
|
+
- name: CMS User
|
15
|
+
created_at: 2010-07-08 02:46:25 Z
|
16
|
+
updated_at: 2010-07-08 02:46:25 Z
|
17
|
+
cms_access: true
|
18
|
+
id: 3
|
19
|
+
guest: false
|
data/seeds/groups.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
- name: Guest
|
3
|
+
created_at: 2010-07-08 02:46:25 Z
|
4
|
+
group_type_id: 1
|
5
|
+
code: guest
|
6
|
+
updated_at: 2010-07-08 02:46:25 Z
|
7
|
+
id: 1
|
8
|
+
- name: Cms Administrators
|
9
|
+
created_at: 2010-07-08 02:46:25 Z
|
10
|
+
group_type_id: 3
|
11
|
+
code: cms-admin
|
12
|
+
updated_at: 2010-07-08 02:46:25 Z
|
13
|
+
id: 2
|
14
|
+
- name: Content Editors
|
15
|
+
created_at: 2010-07-08 02:46:25 Z
|
16
|
+
group_type_id: 3
|
17
|
+
code: content-editor
|
18
|
+
updated_at: 2010-07-08 02:46:25 Z
|
19
|
+
id: 3
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
- id: 1
|
3
|
+
html_block_id: 1
|
4
|
+
version: 1
|
5
|
+
name: Page Not Found
|
6
|
+
content: <p>The page you tried to access does not exist on this server.</p>
|
7
|
+
published: true
|
8
|
+
deleted: false
|
9
|
+
archived: false
|
10
|
+
version_comment: created
|
11
|
+
created_by_id: 1
|
12
|
+
updated_by_id: 1
|
13
|
+
created_at: 2010-07-08 02:46:26 Z
|
14
|
+
updated_at: 2010-07-08 02:46:26 Z
|
15
|
+
- id: 2
|
16
|
+
html_block_id: 2
|
17
|
+
version: 1
|
18
|
+
name: Access Denied
|
19
|
+
content: <p>You have tried to reach a resource or page which you do not have permission to view.</p>
|
20
|
+
published: true
|
21
|
+
deleted: false
|
22
|
+
archived: false
|
23
|
+
version_comment: created
|
24
|
+
created_by_id: 1
|
25
|
+
updated_by_id: 1
|
26
|
+
created_at: 2010-07-08 02:46:26 Z
|
27
|
+
updated_at: 2010-07-08 02:46:26 Z
|
28
|
+
- id: 3
|
29
|
+
html_block_id: 3
|
30
|
+
version: 1
|
31
|
+
name: Server Error
|
32
|
+
content: <p>The server encountered an unexpected condition that prevented it from fulfilling the request.</p>
|
33
|
+
published: true
|
34
|
+
deleted: false
|
35
|
+
archived: false
|
36
|
+
version_comment: created
|
37
|
+
created_by_id: 1
|
38
|
+
updated_by_id: 1
|
39
|
+
created_at: 2010-07-08 02:46:26 Z
|
40
|
+
updated_at: 2010-07-08 02:46:26 Z
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
- updated_by_id: 1
|
3
|
+
name: Page Not Found
|
4
|
+
created_at: 2010-07-08 02:46:26 Z
|
5
|
+
updated_at: 2010-07-08 02:46:26 Z
|
6
|
+
published: true
|
7
|
+
created_by_id: 1
|
8
|
+
lock_version: 0
|
9
|
+
archived: false
|
10
|
+
id: 1
|
11
|
+
deleted: false
|
12
|
+
version: 1
|
13
|
+
content: <p>The page you tried to access does not exist on this server.</p>
|
14
|
+
- updated_by_id: 1
|
15
|
+
name: Access Denied
|
16
|
+
created_at: 2010-07-08 02:46:26 Z
|
17
|
+
updated_at: 2010-07-08 02:46:26 Z
|
18
|
+
published: true
|
19
|
+
created_by_id: 1
|
20
|
+
lock_version: 0
|
21
|
+
archived: false
|
22
|
+
id: 2
|
23
|
+
deleted: false
|
24
|
+
version: 1
|
25
|
+
content: <p>You have tried to reach a resource or page which you do not have permission to view.</p>
|
26
|
+
- updated_by_id: 1
|
27
|
+
name: Server Error
|
28
|
+
created_at: 2010-07-08 02:46:26 Z
|
29
|
+
updated_at: 2010-07-08 02:46:26 Z
|
30
|
+
published: true
|
31
|
+
created_by_id: 1
|
32
|
+
lock_version: 0
|
33
|
+
archived: false
|
34
|
+
id: 3
|
35
|
+
deleted: false
|
36
|
+
version: 1
|
37
|
+
content: <p>The server encountered an unexpected condition that prevented it from fulfilling the request.</p>
|
@@ -0,0 +1,113 @@
|
|
1
|
+
---
|
2
|
+
- id: 1
|
3
|
+
page_id: 1
|
4
|
+
version: 1
|
5
|
+
name: Home
|
6
|
+
path: /
|
7
|
+
template_file_name: default.html.erb
|
8
|
+
cacheable: true
|
9
|
+
hidden: false
|
10
|
+
published: true
|
11
|
+
deleted: false
|
12
|
+
archived: false
|
13
|
+
version_comment: Created
|
14
|
+
created_by_id: 1
|
15
|
+
updated_by_id: 1
|
16
|
+
created_at: 2010-07-08 02:46:26 Z
|
17
|
+
updated_at: 2010-07-08 02:46:26 Z
|
18
|
+
- id: 2
|
19
|
+
page_id: 2
|
20
|
+
version: 1
|
21
|
+
name: Page Not Found
|
22
|
+
path: /system/not_found
|
23
|
+
template_file_name: default.html.erb
|
24
|
+
cacheable: true
|
25
|
+
hidden: true
|
26
|
+
published: true
|
27
|
+
deleted: false
|
28
|
+
archived: false
|
29
|
+
version_comment: Created
|
30
|
+
created_by_id: 1
|
31
|
+
updated_by_id: 1
|
32
|
+
created_at: 2010-07-08 02:46:26 Z
|
33
|
+
updated_at: 2010-07-08 02:46:26 Z
|
34
|
+
- id: 3
|
35
|
+
page_id: 3
|
36
|
+
version: 1
|
37
|
+
name: Access Denied
|
38
|
+
path: /system/access_denied
|
39
|
+
template_file_name: default.html.erb
|
40
|
+
cacheable: true
|
41
|
+
hidden: true
|
42
|
+
published: true
|
43
|
+
deleted: false
|
44
|
+
archived: false
|
45
|
+
version_comment: Created
|
46
|
+
created_by_id: 1
|
47
|
+
updated_by_id: 1
|
48
|
+
created_at: 2010-07-08 02:46:26 Z
|
49
|
+
updated_at: 2010-07-08 02:46:26 Z
|
50
|
+
- id: 4
|
51
|
+
page_id: 4
|
52
|
+
version: 1
|
53
|
+
name: Server Error
|
54
|
+
path: /system/server_error
|
55
|
+
template_file_name: default.html.erb
|
56
|
+
cacheable: true
|
57
|
+
hidden: true
|
58
|
+
published: true
|
59
|
+
deleted: false
|
60
|
+
archived: false
|
61
|
+
version_comment: Created
|
62
|
+
created_by_id: 1
|
63
|
+
updated_by_id: 1
|
64
|
+
created_at: 2010-07-08 02:46:26 Z
|
65
|
+
updated_at: 2010-07-08 02:46:26 Z
|
66
|
+
- id: 5
|
67
|
+
page_id: 2
|
68
|
+
version: 2
|
69
|
+
name: Page Not Found
|
70
|
+
path: /system/not_found
|
71
|
+
template_file_name: default.html.erb
|
72
|
+
cacheable: true
|
73
|
+
hidden: true
|
74
|
+
published: true
|
75
|
+
deleted: false
|
76
|
+
archived: false
|
77
|
+
version_comment: Html Block 'Page Not Found' was added to the 'main' container
|
78
|
+
created_by_id: 1
|
79
|
+
updated_by_id: 1
|
80
|
+
created_at: 2010-07-08 02:46:26 Z
|
81
|
+
updated_at: 2010-07-08 02:46:26 Z
|
82
|
+
- id: 6
|
83
|
+
page_id: 3
|
84
|
+
version: 2
|
85
|
+
name: Access Denied
|
86
|
+
path: /system/access_denied
|
87
|
+
template_file_name: default.html.erb
|
88
|
+
cacheable: true
|
89
|
+
hidden: true
|
90
|
+
published: true
|
91
|
+
deleted: false
|
92
|
+
archived: false
|
93
|
+
version_comment: Html Block 'Access Denied' was added to the 'main' container
|
94
|
+
created_by_id: 1
|
95
|
+
updated_by_id: 1
|
96
|
+
created_at: 2010-07-08 02:46:26 Z
|
97
|
+
updated_at: 2010-07-08 02:46:26 Z
|
98
|
+
- id: 7
|
99
|
+
page_id: 4
|
100
|
+
version: 2
|
101
|
+
name: Server Error
|
102
|
+
path: /system/server_error
|
103
|
+
template_file_name: default.html.erb
|
104
|
+
cacheable: true
|
105
|
+
hidden: true
|
106
|
+
published: true
|
107
|
+
deleted: false
|
108
|
+
archived: false
|
109
|
+
version_comment: Html Block 'Server Error' was added to the 'main' container
|
110
|
+
created_by_id: 1
|
111
|
+
updated_by_id: 1
|
112
|
+
created_at: 2010-07-08 02:46:26 Z
|
113
|
+
updated_at: 2010-07-08 02:46:26 Z
|
data/seeds/pages.yml
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
---
|
2
|
+
- updated_by_id: 1
|
3
|
+
name: Home
|
4
|
+
created_at: 2010-07-08 02:46:26 Z
|
5
|
+
title:
|
6
|
+
template_file_name: default.html.erb
|
7
|
+
updated_at: 2010-07-08 02:46:26 Z
|
8
|
+
published: true
|
9
|
+
created_by_id: 1
|
10
|
+
lock_version: 0
|
11
|
+
language:
|
12
|
+
archived: false
|
13
|
+
id: 1
|
14
|
+
deleted: false
|
15
|
+
version: 1
|
16
|
+
path: /
|
17
|
+
description:
|
18
|
+
keywords:
|
19
|
+
hidden: false
|
20
|
+
cacheable: true
|
21
|
+
- updated_by_id: 1
|
22
|
+
name: Page Not Found
|
23
|
+
created_at: 2010-07-08 02:46:26 Z
|
24
|
+
title:
|
25
|
+
template_file_name: default.html.erb
|
26
|
+
updated_at: 2010-07-08 02:46:26 Z
|
27
|
+
published: true
|
28
|
+
created_by_id: 1
|
29
|
+
lock_version: 0
|
30
|
+
language:
|
31
|
+
archived: false
|
32
|
+
id: 2
|
33
|
+
deleted: false
|
34
|
+
version: 2
|
35
|
+
path: /system/not_found
|
36
|
+
description:
|
37
|
+
keywords:
|
38
|
+
hidden: true
|
39
|
+
cacheable: true
|
40
|
+
- updated_by_id: 1
|
41
|
+
name: Access Denied
|
42
|
+
created_at: 2010-07-08 02:46:26 Z
|
43
|
+
title:
|
44
|
+
template_file_name: default.html.erb
|
45
|
+
updated_at: 2010-07-08 02:46:26 Z
|
46
|
+
published: true
|
47
|
+
created_by_id: 1
|
48
|
+
lock_version: 0
|
49
|
+
language:
|
50
|
+
archived: false
|
51
|
+
id: 3
|
52
|
+
deleted: false
|
53
|
+
version: 2
|
54
|
+
path: /system/access_denied
|
55
|
+
description:
|
56
|
+
keywords:
|
57
|
+
hidden: true
|
58
|
+
cacheable: true
|
59
|
+
- updated_by_id: 1
|
60
|
+
name: Server Error
|
61
|
+
created_at: 2010-07-08 02:46:26 Z
|
62
|
+
title:
|
63
|
+
template_file_name: default.html.erb
|
64
|
+
updated_at: 2010-07-08 02:46:26 Z
|
65
|
+
published: true
|
66
|
+
created_by_id: 1
|
67
|
+
lock_version: 0
|
68
|
+
language:
|
69
|
+
archived: false
|
70
|
+
id: 4
|
71
|
+
deleted: false
|
72
|
+
version: 2
|
73
|
+
path: /system/server_error
|
74
|
+
description:
|
75
|
+
keywords:
|
76
|
+
hidden: true
|
77
|
+
cacheable: true
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
- name: administrate
|
3
|
+
created_at: 2010-07-08 02:46:25 Z
|
4
|
+
updated_at: 2010-07-08 02:46:25 Z
|
5
|
+
for_module:
|
6
|
+
id: 1
|
7
|
+
full_name: Administer CMS
|
8
|
+
description: Allows users to administer the CMS, including adding users and groups.
|
9
|
+
- name: edit_content
|
10
|
+
created_at: 2010-07-08 02:46:25 Z
|
11
|
+
updated_at: 2010-07-08 02:46:25 Z
|
12
|
+
for_module:
|
13
|
+
id: 2
|
14
|
+
full_name: Edit Content
|
15
|
+
description: Allows users to Add, Edit and Delete both Pages and Blocks. Can Save (but not Publish) and Assign them as well.
|
16
|
+
- name: publish_content
|
17
|
+
created_at: 2010-07-08 02:46:25 Z
|
18
|
+
updated_at: 2010-07-08 02:46:25 Z
|
19
|
+
for_module:
|
20
|
+
id: 3
|
21
|
+
full_name: Publish Content
|
22
|
+
description: Allows users to Save and Publish, Hide and Archive both Pages and Blocks.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
- position: 1
|
3
|
+
created_at: 2010-07-08 02:46:26 Z
|
4
|
+
updated_at: 2010-07-08 02:46:26 Z
|
5
|
+
section_id: 1
|
6
|
+
node_type: Section
|
7
|
+
node_id: 2
|
8
|
+
id: 1
|
9
|
+
- position: 2
|
10
|
+
created_at: 2010-07-08 02:46:26 Z
|
11
|
+
updated_at: 2010-07-08 02:46:26 Z
|
12
|
+
section_id: 1
|
13
|
+
node_type: Page
|
14
|
+
node_id: 1
|
15
|
+
id: 2
|
16
|
+
- position: 1
|
17
|
+
created_at: 2010-07-08 02:46:26 Z
|
18
|
+
updated_at: 2010-07-08 02:46:26 Z
|
19
|
+
section_id: 2
|
20
|
+
node_type: Page
|
21
|
+
node_id: 2
|
22
|
+
id: 3
|
23
|
+
- position: 2
|
24
|
+
created_at: 2010-07-08 02:46:26 Z
|
25
|
+
updated_at: 2010-07-08 02:46:26 Z
|
26
|
+
section_id: 2
|
27
|
+
node_type: Page
|
28
|
+
node_id: 3
|
29
|
+
id: 4
|
30
|
+
- position: 3
|
31
|
+
created_at: 2010-07-08 02:46:26 Z
|
32
|
+
updated_at: 2010-07-08 02:46:26 Z
|
33
|
+
section_id: 2
|
34
|
+
node_type: Page
|
35
|
+
node_id: 4
|
36
|
+
id: 5
|
data/seeds/sections.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
- name: My Site
|
3
|
+
created_at: 2010-07-08 02:46:26 Z
|
4
|
+
updated_at: 2010-07-08 02:46:26 Z
|
5
|
+
id: 1
|
6
|
+
root: true
|
7
|
+
path: /
|
8
|
+
hidden: false
|
9
|
+
- name: system
|
10
|
+
created_at: 2010-07-08 02:46:26 Z
|
11
|
+
updated_at: 2010-07-08 02:46:26 Z
|
12
|
+
id: 2
|
13
|
+
root: false
|
14
|
+
path: /system
|
15
|
+
hidden: true
|
data/seeds/sites.yml
ADDED
data/seeds/users.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
- salt: 8829de0bd0a925580b5603afcbbf6ee410b72673
|
3
|
+
expires_at:
|
4
|
+
created_at: 2010-07-08 02:46:25 Z
|
5
|
+
remember_token_expires_at:
|
6
|
+
crypted_password: a65cdaa9260db5207e105d66f24f9ef08b4a6849
|
7
|
+
updated_at: 2010-07-08 02:46:25 Z
|
8
|
+
id: 1
|
9
|
+
remember_token:
|
10
|
+
last_name: Administrator
|
11
|
+
login: cmsadmin
|
12
|
+
first_name: CMS
|
13
|
+
email: cmsadmin@example.com
|
data/spec/bcms_models.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
class Connector < ActiveRecord::Base; end
|
2
|
+
class ContentTypeGroup < ActiveRecord::Base; end
|
3
|
+
class ContentType < ActiveRecord::Base; end
|
4
|
+
class GroupPermission < ActiveRecord::Base; end
|
5
|
+
class GroupSection < ActiveRecord::Base; end
|
6
|
+
class GroupTypePermission < ActiveRecord::Base; end
|
7
|
+
class GroupType < ActiveRecord::Base; end
|
8
|
+
class Group < ActiveRecord::Base; end
|
9
|
+
class HtmlBlock < ActiveRecord::Base; end
|
10
|
+
class Page < ActiveRecord::Base; end
|
11
|
+
class Permission < ActiveRecord::Base; end
|
12
|
+
class SectionNode < ActiveRecord::Base; end
|
13
|
+
class Section < ActiveRecord::Base; end
|
14
|
+
class Site < ActiveRecord::Base; end
|
15
|
+
class UserGroupMembership < ActiveRecord::Base; end
|
16
|
+
class User < ActiveRecord::Base; end
|
data/spec/bcms_schema.rb
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
ActiveRecord::Schema.verbose = false
|
2
|
+
|
3
|
+
begin
|
4
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
5
|
+
rescue ArgumentError
|
6
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
|
7
|
+
end
|
8
|
+
|
9
|
+
ActiveRecord::Base.configurations = true
|
10
|
+
ActiveRecord::Schema.define(:version => 1) do
|
11
|
+
|
12
|
+
create_table "connectors", :force => true do |t|
|
13
|
+
t.integer "page_id"
|
14
|
+
t.integer "page_version"
|
15
|
+
t.integer "connectable_id"
|
16
|
+
t.string "connectable_type"
|
17
|
+
t.integer "connectable_version"
|
18
|
+
t.string "container"
|
19
|
+
t.integer "position"
|
20
|
+
t.datetime "created_at"
|
21
|
+
t.datetime "updated_at"
|
22
|
+
end
|
23
|
+
|
24
|
+
create_table "content_type_groups", :force => true do |t|
|
25
|
+
t.string "name"
|
26
|
+
t.datetime "created_at"
|
27
|
+
t.datetime "updated_at"
|
28
|
+
end
|
29
|
+
|
30
|
+
create_table "content_types", :force => true do |t|
|
31
|
+
t.string "name"
|
32
|
+
t.integer "content_type_group_id"
|
33
|
+
t.integer "priority", :default => 2
|
34
|
+
t.datetime "created_at"
|
35
|
+
t.datetime "updated_at"
|
36
|
+
end
|
37
|
+
|
38
|
+
create_table "group_permissions", :force => true do |t|
|
39
|
+
t.integer "group_id"
|
40
|
+
t.integer "permission_id"
|
41
|
+
end
|
42
|
+
|
43
|
+
create_table "group_sections", :force => true do |t|
|
44
|
+
t.integer "group_id"
|
45
|
+
t.integer "section_id"
|
46
|
+
end
|
47
|
+
|
48
|
+
create_table "group_type_permissions", :force => true do |t|
|
49
|
+
t.integer "group_type_id"
|
50
|
+
t.integer "permission_id"
|
51
|
+
end
|
52
|
+
|
53
|
+
create_table "group_types", :force => true do |t|
|
54
|
+
t.string "name"
|
55
|
+
t.boolean "guest", :default => false
|
56
|
+
t.boolean "cms_access", :default => false
|
57
|
+
t.datetime "created_at"
|
58
|
+
t.datetime "updated_at"
|
59
|
+
end
|
60
|
+
|
61
|
+
create_table "groups", :force => true do |t|
|
62
|
+
t.string "name"
|
63
|
+
t.string "code"
|
64
|
+
t.integer "group_type_id"
|
65
|
+
t.datetime "created_at"
|
66
|
+
t.datetime "updated_at"
|
67
|
+
end
|
68
|
+
|
69
|
+
create_table "html_block_versions", :force => true do |t|
|
70
|
+
t.integer "html_block_id"
|
71
|
+
t.integer "version"
|
72
|
+
t.string "name"
|
73
|
+
t.string "content", :limit => 65537
|
74
|
+
t.boolean "published", :default => false
|
75
|
+
t.boolean "deleted", :default => false
|
76
|
+
t.boolean "archived", :default => false
|
77
|
+
t.string "version_comment"
|
78
|
+
t.integer "created_by_id"
|
79
|
+
t.integer "updated_by_id"
|
80
|
+
t.datetime "created_at"
|
81
|
+
t.datetime "updated_at"
|
82
|
+
end
|
83
|
+
|
84
|
+
create_table "html_blocks", :force => true do |t|
|
85
|
+
t.integer "version"
|
86
|
+
t.integer "lock_version", :default => 0
|
87
|
+
t.string "name"
|
88
|
+
t.string "content", :limit => 65537
|
89
|
+
t.boolean "published", :default => false
|
90
|
+
t.boolean "deleted", :default => false
|
91
|
+
t.boolean "archived", :default => false
|
92
|
+
t.integer "created_by_id"
|
93
|
+
t.integer "updated_by_id"
|
94
|
+
t.datetime "created_at"
|
95
|
+
t.datetime "updated_at"
|
96
|
+
end
|
97
|
+
|
98
|
+
create_table "page_versions", :force => true do |t|
|
99
|
+
t.integer "page_id"
|
100
|
+
t.integer "version"
|
101
|
+
t.string "name"
|
102
|
+
t.string "title"
|
103
|
+
t.string "path"
|
104
|
+
t.string "template_file_name"
|
105
|
+
t.text "description"
|
106
|
+
t.text "keywords"
|
107
|
+
t.string "language"
|
108
|
+
t.boolean "cacheable", :default => false
|
109
|
+
t.boolean "hidden", :default => false
|
110
|
+
t.boolean "published", :default => false
|
111
|
+
t.boolean "deleted", :default => false
|
112
|
+
t.boolean "archived", :default => false
|
113
|
+
t.string "version_comment"
|
114
|
+
t.integer "created_by_id"
|
115
|
+
t.integer "updated_by_id"
|
116
|
+
t.datetime "created_at"
|
117
|
+
t.datetime "updated_at"
|
118
|
+
end
|
119
|
+
|
120
|
+
create_table "pages", :force => true do |t|
|
121
|
+
t.integer "version"
|
122
|
+
t.integer "lock_version", :default => 0
|
123
|
+
t.string "name"
|
124
|
+
t.string "title"
|
125
|
+
t.string "path"
|
126
|
+
t.string "template_file_name"
|
127
|
+
t.text "description"
|
128
|
+
t.text "keywords"
|
129
|
+
t.string "language"
|
130
|
+
t.boolean "cacheable", :default => false
|
131
|
+
t.boolean "hidden", :default => false
|
132
|
+
t.boolean "published", :default => false
|
133
|
+
t.boolean "deleted", :default => false
|
134
|
+
t.boolean "archived", :default => false
|
135
|
+
t.integer "created_by_id"
|
136
|
+
t.integer "updated_by_id"
|
137
|
+
t.datetime "created_at"
|
138
|
+
t.datetime "updated_at"
|
139
|
+
end
|
140
|
+
|
141
|
+
create_table "permissions", :force => true do |t|
|
142
|
+
t.string "name"
|
143
|
+
t.string "full_name"
|
144
|
+
t.string "description"
|
145
|
+
t.string "for_module"
|
146
|
+
t.datetime "created_at"
|
147
|
+
t.datetime "updated_at"
|
148
|
+
end
|
149
|
+
|
150
|
+
create_table "section_nodes", :force => true do |t|
|
151
|
+
t.integer "section_id"
|
152
|
+
t.string "node_type"
|
153
|
+
t.integer "node_id"
|
154
|
+
t.integer "position"
|
155
|
+
t.datetime "created_at"
|
156
|
+
t.datetime "updated_at"
|
157
|
+
end
|
158
|
+
|
159
|
+
create_table "sections", :force => true do |t|
|
160
|
+
t.string "name"
|
161
|
+
t.string "path"
|
162
|
+
t.boolean "root", :default => false
|
163
|
+
t.boolean "hidden", :default => false
|
164
|
+
t.datetime "created_at"
|
165
|
+
t.datetime "updated_at"
|
166
|
+
end
|
167
|
+
|
168
|
+
create_table "sites", :force => true do |t|
|
169
|
+
t.string "name"
|
170
|
+
t.string "domain"
|
171
|
+
t.boolean "the_default"
|
172
|
+
t.datetime "created_at"
|
173
|
+
t.datetime "updated_at"
|
174
|
+
end
|
175
|
+
|
176
|
+
create_table "user_group_memberships", :force => true do |t|
|
177
|
+
t.integer "user_id"
|
178
|
+
t.integer "group_id"
|
179
|
+
end
|
180
|
+
|
181
|
+
create_table "users", :force => true do |t|
|
182
|
+
t.string "login", :limit => 40
|
183
|
+
t.string "first_name", :limit => 40
|
184
|
+
t.string "last_name", :limit => 40
|
185
|
+
t.string "email", :limit => 40
|
186
|
+
t.string "crypted_password", :limit => 40
|
187
|
+
t.string "salt", :limit => 40
|
188
|
+
t.datetime "created_at"
|
189
|
+
t.datetime "updated_at"
|
190
|
+
t.datetime "expires_at"
|
191
|
+
t.string "remember_token", :limit => 40
|
192
|
+
t.datetime "remember_token_expires_at"
|
193
|
+
t.string "reset_token"
|
194
|
+
end
|
195
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'spec_helper')
|
2
|
+
require 'bcms_support/shared'
|
3
|
+
|
4
|
+
describe BcmsSupport::Shared do
|
5
|
+
include BcmsSupport::Shared
|
6
|
+
|
7
|
+
describe "#seed_bcms_data" do
|
8
|
+
class HtmlBlockVersion < ActiveRecord::Base; end
|
9
|
+
class PageVersion < ActiveRecord::Base; end
|
10
|
+
|
11
|
+
before(:all) { seed_bcms_data }
|
12
|
+
|
13
|
+
it "should seed all bcms seed data" do
|
14
|
+
Connector.count.should == 3
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should seed content type groups" do
|
18
|
+
ContentTypeGroup.count.should == 2
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should seed content types" do
|
22
|
+
ContentType.count.should == 7
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should seed group permissions" do
|
26
|
+
GroupPermission.count.should == 3
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should seed group sections" do
|
30
|
+
GroupSection.count.should == 6
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should seed group type permissions" do
|
34
|
+
GroupTypePermission.count.should == 2
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should seed group types" do
|
38
|
+
GroupType.count.should == 3
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should seed group type permissions" do
|
42
|
+
Group.count.should == 3
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should seed group html block versions" do
|
46
|
+
HtmlBlockVersion.count.should == 3
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should seed group html blocks" do
|
50
|
+
HtmlBlock.count.should == 3
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should seed page versions" do
|
54
|
+
PageVersion.count.should == 7
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should seed pages" do
|
58
|
+
Page.count.should == 4
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should seed permissions" do
|
62
|
+
Permission.count.should == 3
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should seed section nodes" do
|
66
|
+
SectionNode.count.should == 5
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should seed sections" do
|
70
|
+
Section.count.should == 2
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should seed sites" do
|
74
|
+
Site.count.should == 1
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should seed sites" do
|
78
|
+
Site.count.should == 1
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should seed user group memberships" do
|
82
|
+
UserGroupMembership.count.should == 2
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should seed users" do
|
86
|
+
User.count.should == 1
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bcms_support
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Juan Alvarez
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-07-10 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Support for testing BrowserCMS modules
|
36
|
+
email: alce@mac.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- LICENSE
|
43
|
+
- README.markdown
|
44
|
+
files:
|
45
|
+
- README.markdown
|
46
|
+
- Rakefile
|
47
|
+
- lib/bcms_support.rb
|
48
|
+
- lib/bcms_support/cucumber.rb
|
49
|
+
- lib/bcms_support/shared.rb
|
50
|
+
- lib/bcms_support/test.rb
|
51
|
+
- seeds/connectors.yml
|
52
|
+
- seeds/content_type_groups.yml
|
53
|
+
- seeds/content_types.yml
|
54
|
+
- seeds/group_permissions.yml
|
55
|
+
- seeds/group_sections.yml
|
56
|
+
- seeds/group_type_permissions.yml
|
57
|
+
- seeds/group_types.yml
|
58
|
+
- seeds/groups.yml
|
59
|
+
- seeds/html_block_versions.yml
|
60
|
+
- seeds/html_blocks.yml
|
61
|
+
- seeds/page_versions.yml
|
62
|
+
- seeds/pages.yml
|
63
|
+
- seeds/permissions.yml
|
64
|
+
- seeds/section_nodes.yml
|
65
|
+
- seeds/sections.yml
|
66
|
+
- seeds/sites.yml
|
67
|
+
- seeds/user_group_memberships.yml
|
68
|
+
- seeds/users.yml
|
69
|
+
- spec/bcms_models.rb
|
70
|
+
- spec/bcms_schema.rb
|
71
|
+
- spec/bcms_support_spec/cucumber_spec.rb
|
72
|
+
- spec/bcms_support_spec/shared_spec.rb
|
73
|
+
- spec/bcms_support_spec/test_spec.rb
|
74
|
+
- spec/spec_helper.rb
|
75
|
+
- LICENSE
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://github.com/alce/bcms_test_support
|
78
|
+
licenses: []
|
79
|
+
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options:
|
82
|
+
- --charset=UTF-8
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
103
|
+
requirements: []
|
104
|
+
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 1.3.7
|
107
|
+
signing_key:
|
108
|
+
specification_version: 3
|
109
|
+
summary: Support for testing BrowserCMS modules
|
110
|
+
test_files:
|
111
|
+
- spec/bcms_models.rb
|
112
|
+
- spec/bcms_schema.rb
|
113
|
+
- spec/bcms_support_spec/cucumber_spec.rb
|
114
|
+
- spec/bcms_support_spec/shared_spec.rb
|
115
|
+
- spec/bcms_support_spec/test_spec.rb
|
116
|
+
- spec/spec_helper.rb
|