bcms_support 0.0.2 → 0.0.3
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 +93 -2
- data/lib/bcms_support/cucumber.rb +1 -1
- data/spec/spec_helper.rb +1 -2
- metadata +3 -3
data/README.markdown
CHANGED
@@ -1,7 +1,98 @@
|
|
1
|
-
##
|
1
|
+
## BcmsSupport
|
2
2
|
|
3
|
+
BcmsSupport is a small but growing set of methods that aims to make testing BrowserCMS modules easier, particularly functional and integration tests.
|
3
4
|
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
gem install bcms_support
|
8
|
+
|
9
|
+
## Setup
|
10
|
+
|
11
|
+
### ActiveSupport::TestCase
|
12
|
+
|
13
|
+
Edit config/environments/test.rb
|
14
|
+
|
15
|
+
config.gem "bcms_support"
|
16
|
+
|
17
|
+
Edit test/test_helper.rb
|
18
|
+
|
19
|
+
require "bcms_support"
|
20
|
+
|
21
|
+
class ActiveSupport::TestCase
|
22
|
+
include BcmsSupport::Test
|
23
|
+
end
|
24
|
+
|
25
|
+
### Rspec
|
26
|
+
|
27
|
+
Edit config/environments/test.rb
|
28
|
+
|
29
|
+
config.gem "bcms_support"
|
30
|
+
|
31
|
+
Edit spec/spec_helper.rb
|
32
|
+
|
33
|
+
require "bcms_support"
|
34
|
+
|
35
|
+
class ActiveSupport::TestCase
|
36
|
+
include BcmsSupport::Test
|
37
|
+
end
|
38
|
+
|
39
|
+
### Cucumber
|
40
|
+
|
41
|
+
Edit config/environments/cucumber.rb
|
42
|
+
|
43
|
+
config.gem "bcms_support"
|
44
|
+
|
45
|
+
Edit features/support/env.rb
|
46
|
+
|
47
|
+
require "bcms_support/cucumber"
|
48
|
+
|
49
|
+
## Usage
|
50
|
+
|
51
|
+
At the moment, this library only provides 3 methods that can be called from Test cases, Example groups or step definitions.
|
52
|
+
Please note that BcmsSupport is *very* young and as the collection of methods grow, the API may also change dramatically.
|
53
|
+
|
54
|
+
*seed\_bcms\_data* => loads all data seeded by BrowserCMS' migrations into your test database.
|
55
|
+
*login/_as(user)* => Simulates a logged in user by setting session[:user_id] to the passed in user's id.
|
56
|
+
*publish\_all\_pages* => Page.all.each(:&publish)
|
57
|
+
|
58
|
+
Example:
|
59
|
+
|
60
|
+
class BlogControllerTest < ActionController::TestCase
|
61
|
+
|
62
|
+
def setup
|
63
|
+
seed_bcms_data
|
64
|
+
login_as(some_user)
|
65
|
+
end
|
66
|
+
#...
|
67
|
+
end
|
68
|
+
|
69
|
+
Or, if you are using Rspec:
|
70
|
+
|
71
|
+
describe BlogControler do
|
72
|
+
|
73
|
+
before(:all) { seed_bcms_data }
|
74
|
+
before(:each) { login_as(some_user) }
|
75
|
+
#...
|
76
|
+
end
|
77
|
+
|
78
|
+
Lastly, they can be used on step definitions as well:
|
79
|
+
|
80
|
+
Given /^All BrowserCMS' seed data exists$/ do
|
81
|
+
seed_bcms_data
|
82
|
+
end
|
83
|
+
|
84
|
+
Given /^I am logged in as "([^"]*)"$/ do |name|
|
85
|
+
# login_as expects a user object
|
86
|
+
login_as(Factory(:user, :name => name))
|
87
|
+
end
|
88
|
+
|
89
|
+
## Development
|
90
|
+
|
91
|
+
BcmsSupport is in it's infancy and under heavy development. The idea is to extract data, methods and step definitions that deal with BrowserCMS itself
|
92
|
+
and are commonly used across different modules.
|
93
|
+
|
94
|
+
Ideas and contributions are more than welcome.
|
4
95
|
|
5
96
|
## Copyright
|
6
97
|
|
7
|
-
Copyright (c) 2010 Juan Alvarez. See LICENSE for details.
|
98
|
+
Copyright (c) 2010 Juan Alvarez. See LICENSE for details.
|
data/spec/spec_helper.rb
CHANGED
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: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Juan Alvarez
|