bcms_support 0.0.3 → 0.0.4
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/README.markdown +36 -6
- data/Rakefile +1 -1
- data/lib/bcms_support/factories.rb +109 -0
- metadata +6 -5
data/README.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
## BcmsSupport
|
2
2
|
|
3
|
-
BcmsSupport is a small but growing set of methods that aims to make testing BrowserCMS modules easier
|
3
|
+
BcmsSupport is a small but growing set of methods that aims to make testing BrowserCMS modules easier.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -32,8 +32,8 @@ Edit spec/spec_helper.rb
|
|
32
32
|
|
33
33
|
require "bcms_support"
|
34
34
|
|
35
|
-
|
36
|
-
include BcmsSupport::Test
|
35
|
+
Spec::Runner.configure do |config|
|
36
|
+
config.include BcmsSupport::Test
|
37
37
|
end
|
38
38
|
|
39
39
|
### Cucumber
|
@@ -45,15 +45,45 @@ Edit config/environments/cucumber.rb
|
|
45
45
|
Edit features/support/env.rb
|
46
46
|
|
47
47
|
require "bcms_support/cucumber"
|
48
|
+
|
49
|
+
### Factories
|
50
|
+
|
51
|
+
This library includes factory definitions for the following BrowserCMS models (lifted directly from BrowserCMS' source):
|
52
|
+
|
53
|
+
* Category
|
54
|
+
* CategoryType
|
55
|
+
* Connector
|
56
|
+
* FileBlock
|
57
|
+
* Group
|
58
|
+
* GroupType
|
59
|
+
* HtmlBlock
|
60
|
+
* ImageBlock
|
61
|
+
* Link
|
62
|
+
* Page
|
63
|
+
* PagePartial
|
64
|
+
* PageRoute
|
65
|
+
* PageTemplate
|
66
|
+
* Permission
|
67
|
+
* Section
|
68
|
+
* Site
|
69
|
+
* Task
|
70
|
+
* User
|
71
|
+
|
72
|
+
To use them, just require them wherever you require factory_girl
|
73
|
+
|
74
|
+
require "factory_girl"
|
75
|
+
require "bcms_support/factories"
|
76
|
+
|
77
|
+
You can define your module's factories the way you normally do, just keep in mind that you cannot define factories with the same names enlisted above.
|
48
78
|
|
49
79
|
## Usage
|
50
80
|
|
51
81
|
At the moment, this library only provides 3 methods that can be called from Test cases, Example groups or step definitions.
|
52
82
|
Please note that BcmsSupport is *very* young and as the collection of methods grow, the API may also change dramatically.
|
53
83
|
|
54
|
-
*
|
55
|
-
*
|
56
|
-
*
|
84
|
+
* __seed\_bcms\_data__ => loads all data seeded by BrowserCMS' migrations into your test database.
|
85
|
+
* __login\_as(user)__ => Simulates a logged in user by setting session[:user_id] to the passed in user's id.
|
86
|
+
* __publish\_all\_pages__ => Page.all.each(:&publish)
|
57
87
|
|
58
88
|
Example:
|
59
89
|
|
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ begin
|
|
14
14
|
gem.summary = %Q{Support for testing BrowserCMS modules}
|
15
15
|
gem.description = %Q{Support for testing BrowserCMS modules}
|
16
16
|
gem.email = "alce@mac.com"
|
17
|
-
gem.homepage = "http://github.com/alce/
|
17
|
+
gem.homepage = "http://github.com/alce/bcms_support"
|
18
18
|
gem.authors = ["Juan Alvarez"]
|
19
19
|
gem.files = %w[LICENCE README.markdown Rakefile] + Dir.glob("{rails,lib,spec,seeds}/**/*")
|
20
20
|
gem.add_development_dependency 'rspec'
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# These definitions were lifted directly from BrowserCMS' source
|
2
|
+
|
3
|
+
Factory.define :category do |m|
|
4
|
+
m.association :category_type
|
5
|
+
m.sequence(:name) {|n| "TestCategory#{n}"}
|
6
|
+
end
|
7
|
+
|
8
|
+
Factory.define :category_type do |m|
|
9
|
+
m.sequence(:name) {|n| "TestCategoryType#{n}"}
|
10
|
+
end
|
11
|
+
|
12
|
+
Factory.define :connector do |m|
|
13
|
+
m.association :page
|
14
|
+
m.page_version 1
|
15
|
+
m.container "main"
|
16
|
+
m.association :connectable, :factory => :html_block
|
17
|
+
m.connectable_version 1
|
18
|
+
end
|
19
|
+
|
20
|
+
Factory.define :file_block do |m|
|
21
|
+
m.sequence(:name) {|n| "TestFileBlock#{n}"}
|
22
|
+
end
|
23
|
+
|
24
|
+
Factory.define :group do |m|
|
25
|
+
m.sequence(:name) {|n| "TestGroup#{n}" }
|
26
|
+
end
|
27
|
+
|
28
|
+
Factory.define :group_type do |m|
|
29
|
+
m.sequence(:name) {|n| "TestGroupType#{n}" }
|
30
|
+
end
|
31
|
+
|
32
|
+
Factory.define :html_block do |m|
|
33
|
+
m.name "About Us"
|
34
|
+
m.content "<h1>About Us</h1>\n<p>Lorem ipsum dolor sit amet...</p>"
|
35
|
+
end
|
36
|
+
|
37
|
+
Factory.define :image_block do |m|
|
38
|
+
m.sequence(:name) {|n| "TestImageBlock#{n}"}
|
39
|
+
end
|
40
|
+
|
41
|
+
Factory.define :link do |m|
|
42
|
+
m.sequence(:name) {|n| "Link #{n}"}
|
43
|
+
end
|
44
|
+
|
45
|
+
Factory.define :page do |m|
|
46
|
+
m.sequence(:name) {|n| "Page #{n}" }
|
47
|
+
m.path {|a| "/#{a.name.gsub(/\s/,'_').downcase}" }
|
48
|
+
m.template_file_name "default.html.erb"
|
49
|
+
m.association :section
|
50
|
+
end
|
51
|
+
|
52
|
+
Factory.define :page_partial do |m|
|
53
|
+
m.sequence(:name) {|n| "_page_partial_#{n}" }
|
54
|
+
m.format "html"
|
55
|
+
m.handler "erb"
|
56
|
+
end
|
57
|
+
|
58
|
+
Factory.define :page_routes do |m|
|
59
|
+
m.sequence(:pattern) {|n| "/page_route_#{n}"}
|
60
|
+
m.association :page
|
61
|
+
end
|
62
|
+
|
63
|
+
Factory.define :page_template do |m|
|
64
|
+
m.sequence(:name) {|n| "page_template_#{n}" }
|
65
|
+
m.format "html"
|
66
|
+
m.handler "erb"
|
67
|
+
m.body %q{<html>
|
68
|
+
<head>
|
69
|
+
<title>
|
70
|
+
<%= page_title %>
|
71
|
+
</title>
|
72
|
+
<%= yield :html_head %>
|
73
|
+
</head>
|
74
|
+
<body>
|
75
|
+
<%= cms_toolbar %>
|
76
|
+
<%= container :main %>
|
77
|
+
</body>
|
78
|
+
</html>}
|
79
|
+
end
|
80
|
+
|
81
|
+
Factory.define :permission do |m|
|
82
|
+
m.sequence(:name) {|n| "TestPermission#{n}" }
|
83
|
+
end
|
84
|
+
|
85
|
+
Factory.define :section do |m|
|
86
|
+
m.name "Test"
|
87
|
+
m.path "/"
|
88
|
+
m.parent { Section.root.first }
|
89
|
+
end
|
90
|
+
|
91
|
+
Factory.define :site do |m|
|
92
|
+
m.sequence(:name) {|n| "Test #{n}"}
|
93
|
+
m.domain {|a| "#{a.name.gsub(/\s/,"_").downcase}.com" }
|
94
|
+
end
|
95
|
+
|
96
|
+
Factory.define :task do |m|
|
97
|
+
m.association :assigned_by, :factory => :user
|
98
|
+
m.association :assigned_to, :factory => :user
|
99
|
+
m.association :page
|
100
|
+
end
|
101
|
+
|
102
|
+
Factory.define :user do |m|
|
103
|
+
m.first_name "Test"
|
104
|
+
m.last_name "User"
|
105
|
+
m.sequence(:login) {|n| "test_#{n}" }
|
106
|
+
m.email {|a| "#{a.login}@example.com" }
|
107
|
+
m.password "password"
|
108
|
+
m.password_confirmation {|a| a.password }
|
109
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcms_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Juan Alvarez
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-11 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- Rakefile
|
47
47
|
- lib/bcms_support.rb
|
48
48
|
- lib/bcms_support/cucumber.rb
|
49
|
+
- lib/bcms_support/factories.rb
|
49
50
|
- lib/bcms_support/shared.rb
|
50
51
|
- lib/bcms_support/test.rb
|
51
52
|
- seeds/connectors.yml
|
@@ -74,7 +75,7 @@ files:
|
|
74
75
|
- spec/spec_helper.rb
|
75
76
|
- LICENSE
|
76
77
|
has_rdoc: true
|
77
|
-
homepage: http://github.com/alce/
|
78
|
+
homepage: http://github.com/alce/bcms_support
|
78
79
|
licenses: []
|
79
80
|
|
80
81
|
post_install_message:
|