rspec_generator 0.5.9 → 0.5.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README +7 -0
- data/lib/controller_mixin.rb +0 -1
- data/lib/rspec_on_rails.rb +19 -0
- data/templates/rspec.rake +29 -9
- metadata +3 -3
data/README
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
This directory contains the sources for RSpec on Rails,
|
2
|
+
which is a set of extensions to RSpec to port fixtures
|
3
|
+
and other common Rails testing features to RSpec.
|
4
|
+
|
5
|
+
There is also a set of generators for setting up a Rails
|
6
|
+
project for RSpec and generate spec skeletons.
|
7
|
+
|
1
8
|
Please refer to the Documentation on the website:
|
2
9
|
|
3
10
|
http://rspec.rubyforge.org/tools/rails.html
|
data/lib/controller_mixin.rb
CHANGED
data/lib/rspec_on_rails.rb
CHANGED
@@ -65,3 +65,22 @@ module Spec
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
module ActionController
|
69
|
+
class TestResponse
|
70
|
+
def should_render(expected=nil)
|
71
|
+
rendered = expected ? rendered_file(!expected.include?('/')) : rendered_file
|
72
|
+
expected.should_equal rendered
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class String
|
78
|
+
def should_have_tag(*opts)
|
79
|
+
opts = opts.size > 1 ? opts.last.merge({ :tag => opts.first.to_s }) : opts.first
|
80
|
+
begin
|
81
|
+
HTML::Document.new(self).find(opts).should_not_be_nil
|
82
|
+
rescue
|
83
|
+
self.should_include opts.inspect
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/templates/rspec.rake
CHANGED
@@ -13,15 +13,35 @@ task :spec do
|
|
13
13
|
raise "RSpec failures" if got_error
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
16
|
namespace :spec do
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
desc "Run the specs under spec/models"
|
18
|
+
Spec::Rake::SpecTask.new(:models => "db:test:prepare") do |t|
|
19
|
+
t.spec_files = FileList['spec/models/**/*_spec.rb']
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Run the specs under spec/controllers"
|
23
|
+
Spec::Rake::SpecTask.new(:controllers => "db:test:prepare") do |t|
|
24
|
+
t.spec_files = FileList['spec/controllers/**/*_spec.rb']
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Print Specdoc for all specs"
|
28
|
+
Spec::Rake::SpecTask.new('doc') do |t|
|
29
|
+
t.spec_files = FileList[
|
30
|
+
'spec/models/**/*_spec.rb',
|
31
|
+
'spec/controllers/**/*_spec.rb'
|
32
|
+
]
|
33
|
+
t.spec_opts = ["--format", "specdoc"]
|
34
|
+
end
|
35
|
+
|
36
|
+
namespace :translate do
|
37
|
+
desc "Translate test/unit to spec/models"
|
38
|
+
task :unit do
|
39
|
+
`test2spec --specdir spec/models test/unit`
|
40
|
+
end
|
22
41
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
42
|
+
desc "Translate test/functional to spec/controllers"
|
43
|
+
task :functional do
|
44
|
+
`test2spec --specdir spec/controllers test/functional`
|
45
|
+
end
|
46
|
+
end
|
27
47
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rspec_generator
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.5.
|
7
|
-
date: 2006-06-
|
6
|
+
version: 0.5.10
|
7
|
+
date: 2006-06-14 00:00:00 -05:00
|
8
8
|
summary: RSpec plugin and generator for Ruby on Rails
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -67,5 +67,5 @@ dependencies:
|
|
67
67
|
requirements:
|
68
68
|
- - "="
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.5.
|
70
|
+
version: 0.5.10
|
71
71
|
version:
|