refinerycms-testing 0.9.9.22 → 1.0.0
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/features/step_definitions/web_steps.rb +8 -0
- data/features/support/paths.rb +3 -2
- data/lib/gemspec.rb +3 -0
- data/lib/generators/refinerycms_testing_generator.rb +15 -4
- data/lib/tasks/rcov.rake +47 -0
- data/refinerycms-testing.gemspec +11 -4
- data/spec/spec_helper.rb +12 -5
- data/spec/support/refinery/controller_macros.rb +27 -0
- metadata +16 -3
@@ -214,6 +214,14 @@ Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
|
214
214
|
end
|
215
215
|
end
|
216
216
|
|
217
|
+
Then /the page should have the css "(.*)"$/ do |expected_css|
|
218
|
+
page.should have_css(expected_css)
|
219
|
+
end
|
220
|
+
|
217
221
|
Then /^show me the page$/ do
|
218
222
|
save_and_open_page
|
219
223
|
end
|
224
|
+
|
225
|
+
Then /^output the page$/ do
|
226
|
+
puts page.body
|
227
|
+
end
|
data/features/support/paths.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
::Refinery::Plugins.registered.map{|
|
2
|
-
|
1
|
+
([Rails.root] | ::Refinery::Plugins.registered.pathnames).map{|path|
|
2
|
+
path.join('features', 'support', 'paths.rb')
|
3
3
|
}.reject{|p| !p.exist?}.each do |paths|
|
4
4
|
require paths
|
5
5
|
end
|
@@ -21,6 +21,7 @@ module NavigationHelpers
|
|
21
21
|
# end
|
22
22
|
# end
|
23
23
|
# end
|
24
|
+
|
24
25
|
NavigationHelpers::Refinery.constants.each do |name|
|
25
26
|
begin
|
26
27
|
if (mod = "NavigationHelpers::Refinery::#{name}".constantize)
|
data/lib/gemspec.rb
CHANGED
@@ -41,6 +41,9 @@ Gem::Specification.new do |s|
|
|
41
41
|
s.add_dependency 'autotest-rails'
|
42
42
|
s.add_dependency 'autotest-notification'
|
43
43
|
|
44
|
+
# RCov
|
45
|
+
s.add_dependency 'rcov'
|
46
|
+
|
44
47
|
s.files = [
|
45
48
|
'#{%w( **/{*,.rspec,.gitignore,.yardopts} ).map { |file| Pathname.glob(gempath.join(file)) }.flatten.reject{|f|
|
46
49
|
!f.exist? or f.to_s =~ /\.gem$/ or (f.directory? and f.children.empty?)
|
@@ -6,10 +6,21 @@ class RefinerycmsTesting < ::Refinery::Generators::EngineInstaller
|
|
6
6
|
engine_name "testing"
|
7
7
|
|
8
8
|
def generate
|
9
|
-
copy_file 'config/cucumber.yml',
|
10
|
-
|
11
|
-
|
12
|
-
copy_file '.
|
9
|
+
copy_file 'config/cucumber.yml',
|
10
|
+
Rails.root.join('config', 'cucumber.yml')
|
11
|
+
|
12
|
+
copy_file 'spec/spec_helper.rb',
|
13
|
+
Rails.root.join('spec', 'spec_helper.rb')
|
14
|
+
|
15
|
+
copy_file 'spec/rcov.opts',
|
16
|
+
Rails.root.join('spec', 'rcov.opts')
|
17
|
+
|
18
|
+
copy_file 'spec/support/refinery/controller_macros.rb',
|
19
|
+
Rails.root.join('spec', 'support', 'refinery', 'controller_macros.rb')
|
20
|
+
|
21
|
+
copy_file '.rspec',
|
22
|
+
Rails.root.join('.rspec')
|
23
|
+
|
13
24
|
copy_file 'lib/generators/templates/features/support/paths.rb',
|
14
25
|
Rails.root.join('features', 'support', 'paths.rb')
|
15
26
|
end
|
data/lib/tasks/rcov.rake
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Forked to get it working with Rails 3 and RSpec 2
|
2
|
+
#
|
3
|
+
# From http://github.com/jaymcgavren
|
4
|
+
#
|
5
|
+
# Save this as rcov.rake in lib/tasks and use rcov:all =>
|
6
|
+
# to get accurate spec/feature coverage data
|
7
|
+
#
|
8
|
+
# Use rcov:rspec or rcov:cucumber
|
9
|
+
# to get non-aggregated coverage reports for rspec or cucumber separately
|
10
|
+
|
11
|
+
require 'cucumber/rake/task'
|
12
|
+
require "rspec/core/rake_task"
|
13
|
+
|
14
|
+
namespace :rcov do
|
15
|
+
Cucumber::Rake::Task.new(:cucumber_run) do |t|
|
16
|
+
t.rcov = true
|
17
|
+
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data}
|
18
|
+
t.rcov_opts << %[-o "coverage"]
|
19
|
+
end
|
20
|
+
|
21
|
+
RSpec::Core::RakeTask.new(:rspec_run) do |t|
|
22
|
+
t.pattern = '**/*_spec.rb'
|
23
|
+
t.rcov = true
|
24
|
+
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/}
|
25
|
+
t.rcov_opts << '--aggregate coverage.data'
|
26
|
+
t.rcov_opts << %[-o "coverage"]
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "Run both specs and features to generate aggregated coverage"
|
30
|
+
task :all do |t|
|
31
|
+
rm "coverage.data" if File.exist?("coverage.data")
|
32
|
+
Rake::Task["rcov:cucumber_run"].invoke
|
33
|
+
Rake::Task["rcov:rspec_run"].invoke
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Run only rspecs"
|
37
|
+
task :rspec do |t|
|
38
|
+
rm "coverage.data" if File.exist?("coverage.data")
|
39
|
+
Rake::Task["rcov:rspec_run"].invoke
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Run only cucumber"
|
43
|
+
task :cucumber do |t|
|
44
|
+
rm "coverage.data" if File.exist?("coverage.data")
|
45
|
+
Rake::Task["rcov:cucumber_run"].invoke
|
46
|
+
end
|
47
|
+
end
|
data/refinerycms-testing.gemspec
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{refinerycms-testing}
|
5
|
-
s.version = %q{0.
|
5
|
+
s.version = %q{1.0.0}
|
6
6
|
s.summary = %q{Testing plugin for Refinery CMS}
|
7
7
|
s.description = %q{This plugin adds the ability to run cucumber and rspec against the RefineryCMS gem while inside a RefineryCMS project}
|
8
|
-
s.date = %q{2011-05-
|
8
|
+
s.date = %q{2011-05-28}
|
9
9
|
s.email = %q{info@refinerycms.com}
|
10
10
|
s.homepage = %q{http://refinerycms.com}
|
11
11
|
s.rubyforge_project = %q{refinerycms}
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.require_paths = %w(lib)
|
15
15
|
s.executables = %w()
|
16
16
|
|
17
|
-
s.add_dependency 'refinerycms-core', '= 0.
|
17
|
+
s.add_dependency 'refinerycms-core', '= 1.0.0'
|
18
18
|
# RSpec
|
19
19
|
s.add_dependency 'rspec-rails', '~> 2.6'
|
20
20
|
|
@@ -36,6 +36,9 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_dependency 'autotest-rails'
|
37
37
|
s.add_dependency 'autotest-notification'
|
38
38
|
|
39
|
+
# RCov
|
40
|
+
s.add_dependency 'rcov'
|
41
|
+
|
39
42
|
s.files = [
|
40
43
|
'.rspec',
|
41
44
|
'config',
|
@@ -59,9 +62,13 @@ Gem::Specification.new do |s|
|
|
59
62
|
'lib/refinerycms-testing.rb',
|
60
63
|
'lib/tasks',
|
61
64
|
'lib/tasks/cucumber.rake',
|
65
|
+
'lib/tasks/rcov.rake',
|
62
66
|
'refinerycms-testing.gemspec',
|
63
67
|
'spec',
|
64
68
|
'spec/rcov.opts',
|
65
|
-
'spec/spec_helper.rb'
|
69
|
+
'spec/spec_helper.rb',
|
70
|
+
'spec/support',
|
71
|
+
'spec/support/refinery',
|
72
|
+
'spec/support/refinery/controller_macros.rb'
|
66
73
|
]
|
67
74
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'rbconfig'
|
2
|
+
require 'factory_girl'
|
3
|
+
require File.expand_path('../support/refinery/controller_macros', __FILE__)
|
4
|
+
|
2
5
|
def setup_environment
|
3
6
|
# This file is copied to ~/spec when you run 'rails generate rspec'
|
4
7
|
# from the project root directory.
|
@@ -27,6 +30,9 @@ def setup_environment
|
|
27
30
|
# instead of true.
|
28
31
|
config.use_transactional_fixtures = true
|
29
32
|
config.use_instantiated_fixtures = false
|
33
|
+
|
34
|
+
config.include ::Devise::TestHelpers, :type => :controller
|
35
|
+
config.extend ::Refinery::ControllerMacros, :type => :controller
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
@@ -64,13 +70,14 @@ else
|
|
64
70
|
each_run
|
65
71
|
end
|
66
72
|
|
67
|
-
def capture_stdout(
|
68
|
-
original_stdout = $stdout
|
69
|
-
$stdout = fake = StringIO.new
|
73
|
+
def capture_stdout(stdin_str = '')
|
70
74
|
begin
|
75
|
+
require 'stringio'
|
76
|
+
$o_stdin, $o_stdout, $o_stderr = $stdin, $stdout, $stderr
|
77
|
+
$stdin, $stdout, $stderr = StringIO.new(stdin_str), StringIO.new, StringIO.new
|
71
78
|
yield
|
79
|
+
{:stdout => $stdout.string, :stderr => $stderr.string}
|
72
80
|
ensure
|
73
|
-
$stdout =
|
81
|
+
$stdin, $stdout, $stderr = $o_stdin, $o_stdout, $o_stderr
|
74
82
|
end
|
75
|
-
fake.string
|
76
83
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Refinery
|
2
|
+
module ControllerMacros
|
3
|
+
def login_user
|
4
|
+
before (:each) do
|
5
|
+
@user = Factory(:user)
|
6
|
+
@request.env["devise.mapping"] = Devise.mappings[:admin]
|
7
|
+
sign_in @user
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def login_refinery_user
|
12
|
+
before (:each) do
|
13
|
+
@refinery_user = Factory(:refinery_user)
|
14
|
+
@request.env["devise.mapping"] = Devise.mappings[:admin]
|
15
|
+
sign_in @refinery_user
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def login_refinery_translator
|
20
|
+
before (:each) do
|
21
|
+
@refinery_translator = Factory(:refinery_translator)
|
22
|
+
@request.env["devise.mapping"] = Devise.mappings[:admin]
|
23
|
+
sign_in @refinery_translator
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: refinerycms-testing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 1.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Philip Arndt
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-28 00:00:00 +12:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
requirements:
|
22
22
|
- - "="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version: 0.
|
24
|
+
version: 1.0.0
|
25
25
|
type: :runtime
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -167,6 +167,17 @@ dependencies:
|
|
167
167
|
version: "0"
|
168
168
|
type: :runtime
|
169
169
|
version_requirements: *id014
|
170
|
+
- !ruby/object:Gem::Dependency
|
171
|
+
name: rcov
|
172
|
+
prerelease: false
|
173
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
174
|
+
none: false
|
175
|
+
requirements:
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: "0"
|
179
|
+
type: :runtime
|
180
|
+
version_requirements: *id015
|
170
181
|
description: This plugin adds the ability to run cucumber and rspec against the RefineryCMS gem while inside a RefineryCMS project
|
171
182
|
email: info@refinerycms.com
|
172
183
|
executables: []
|
@@ -188,9 +199,11 @@ files:
|
|
188
199
|
- lib/generators/templates/features/support/paths.rb
|
189
200
|
- lib/refinerycms-testing.rb
|
190
201
|
- lib/tasks/cucumber.rake
|
202
|
+
- lib/tasks/rcov.rake
|
191
203
|
- refinerycms-testing.gemspec
|
192
204
|
- spec/rcov.opts
|
193
205
|
- spec/spec_helper.rb
|
206
|
+
- spec/support/refinery/controller_macros.rb
|
194
207
|
has_rdoc: true
|
195
208
|
homepage: http://refinerycms.com
|
196
209
|
licenses:
|