rspec-rails 2.0.0.beta.3 → 2.0.0.beta.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +14 -18
- data/VERSION +1 -1
- data/lib/generators/rspec/scaffold/scaffold_generator.rb +7 -6
- data/lib/rspec/rails/matchers.rb +11 -5
- data/rspec-rails.gemspec +7 -7
- metadata +7 -7
data/Rakefile
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
gem 'jeweler', '>= 1.4.0'
|
3
1
|
require 'rake'
|
4
2
|
require 'yaml'
|
5
3
|
|
@@ -47,24 +45,22 @@ namespace :gem do
|
|
47
45
|
end
|
48
46
|
end
|
49
47
|
|
48
|
+
namespace :rails do
|
49
|
+
desc "clone the rails repo"
|
50
|
+
task :clone do
|
51
|
+
mkdir 'tmp' unless File.directory?('tmp')
|
52
|
+
unless File.directory?('tmp/rails')
|
53
|
+
Dir.chdir('tmp') do
|
54
|
+
sh "git clone git://github.com/rails/rails"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
50
60
|
namespace :generate do
|
51
61
|
desc "generate a fresh app with rspec installed"
|
52
|
-
task :app => :clobber_app do |t|
|
53
|
-
|
54
|
-
ruby "./tmp/rails/railties/bin/rails tmp/example_app --dev -m example_app_template.rb"
|
55
|
-
else
|
56
|
-
puts <<-MESSAGE
|
57
|
-
|
58
|
-
You need to install rails in ./tmp/rails before you can run the
|
59
|
-
#{t.name} task:
|
60
|
-
|
61
|
-
git clone git://github.com/rails/rails tmp/rails
|
62
|
-
|
63
|
-
(We'll automate this eventually, but running 'git clone' from rake in this
|
64
|
-
project is mysteriously full of fail)
|
65
|
-
|
66
|
-
MESSAGE
|
67
|
-
end
|
62
|
+
task :app => ["rails:clone", :clobber_app] do |t|
|
63
|
+
ruby "./tmp/rails/railties/bin/rails tmp/example_app --dev -m example_app_template.rb"
|
68
64
|
end
|
69
65
|
|
70
66
|
desc "generate a bunch of stuff with generators"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0.beta.
|
1
|
+
2.0.0.beta.4
|
@@ -11,19 +11,20 @@ module Rspec
|
|
11
11
|
class_option :template_engine, :desc => "Template engine to generate view files"
|
12
12
|
class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller"
|
13
13
|
|
14
|
-
class_option :
|
15
|
-
class_option :
|
16
|
-
class_option :
|
14
|
+
class_option :controller_specs, :type => :boolean, :default => true, :desc => "Generate controller specs"
|
15
|
+
class_option :view_specs, :type => :boolean, :default => true, :desc => "Generate view specs"
|
16
|
+
class_option :helper_specs, :type => :boolean, :default => true, :desc => "Generate helper specs"
|
17
|
+
class_option :routing_specs, :type => :boolean, :default => false, :desc => "Generate routing specs"
|
17
18
|
|
18
19
|
def copy_controller_files
|
19
|
-
return unless options[:
|
20
|
+
return unless options[:controller_specs]
|
20
21
|
|
21
22
|
template 'controller_spec.rb',
|
22
23
|
File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb")
|
23
24
|
end
|
24
25
|
|
25
26
|
def copy_view_files
|
26
|
-
return unless options[:
|
27
|
+
return unless options[:view_specs]
|
27
28
|
|
28
29
|
copy_view :edit
|
29
30
|
copy_view :index unless options[:singleton]
|
@@ -32,7 +33,7 @@ module Rspec
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def copy_routing_files
|
35
|
-
return unless options[:
|
36
|
+
return unless options[:routing_specs]
|
36
37
|
|
37
38
|
template 'routing_spec.rb',
|
38
39
|
File.join('spec/routing', controller_class_path, "#{controller_file_name}_routing_spec.rb")
|
data/lib/rspec/rails/matchers.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'rspec/matchers'
|
2
2
|
|
3
|
-
#try to fix load error for ruby1.9.1
|
4
3
|
begin
|
5
4
|
require 'test/unit/assertionfailederror'
|
6
5
|
rescue LoadError
|
@@ -18,22 +17,29 @@ module Rspec
|
|
18
17
|
include Rspec::Matchers
|
19
18
|
|
20
19
|
def redirect_to(destination)
|
21
|
-
|
20
|
+
running_example = self
|
22
21
|
Matcher.new :redirect_to, destination do |destination_|
|
23
22
|
match_unless_raises Test::Unit::AssertionFailedError do |_|
|
24
|
-
|
23
|
+
running_example.assert_redirected_to destination_
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
28
27
|
|
29
28
|
def render_template(options={}, message=nil)
|
30
|
-
|
29
|
+
running_example = self
|
31
30
|
Matcher.new :render_template, options, message do |options_, message_|
|
32
31
|
match_unless_raises Test::Unit::AssertionFailedError do |_|
|
33
|
-
|
32
|
+
running_example.assert_template options_, message_
|
34
33
|
end
|
35
34
|
end
|
36
35
|
end
|
36
|
+
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
Rspec::Matchers.define :be_a_new do |model_klass|
|
42
|
+
match do |actual|
|
43
|
+
model_klass === actual && actual.new_record?
|
44
|
+
end
|
45
|
+
end
|
data/rspec-rails.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rspec-rails}
|
8
|
-
s.version = "2.0.0.beta.
|
8
|
+
s.version = "2.0.0.beta.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David Chelimsky", "Chad Humphries"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-15}
|
13
13
|
s.description = %q{Rspec-2 for Rails-3}
|
14
14
|
s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -69,7 +69,7 @@ Gem::Specification.new do |s|
|
|
69
69
|
s.homepage = %q{http://github.com/rspec/rspec-rails}
|
70
70
|
s.post_install_message = %q{**************************************************
|
71
71
|
|
72
|
-
Thank you for installing rspec-rails-2.0.0.beta.
|
72
|
+
Thank you for installing rspec-rails-2.0.0.beta.4!
|
73
73
|
|
74
74
|
This version of rspec-rails only works with
|
75
75
|
versions of rails >= 3.0.0.pre.
|
@@ -84,21 +84,21 @@ Gem::Specification.new do |s|
|
|
84
84
|
s.require_paths = ["lib"]
|
85
85
|
s.rubyforge_project = %q{rspec}
|
86
86
|
s.rubygems_version = %q{1.3.6}
|
87
|
-
s.summary = %q{rspec-rails-2.0.0.beta.
|
87
|
+
s.summary = %q{rspec-rails-2.0.0.beta.4}
|
88
88
|
|
89
89
|
if s.respond_to? :specification_version then
|
90
90
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
91
91
|
s.specification_version = 3
|
92
92
|
|
93
93
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
94
|
-
s.add_runtime_dependency(%q<rspec>, ["= 2.0.0.beta.
|
94
|
+
s.add_runtime_dependency(%q<rspec>, ["= 2.0.0.beta.4"])
|
95
95
|
s.add_runtime_dependency(%q<webrat>, [">= 0.7.0"])
|
96
96
|
else
|
97
|
-
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.
|
97
|
+
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.4"])
|
98
98
|
s.add_dependency(%q<webrat>, [">= 0.7.0"])
|
99
99
|
end
|
100
100
|
else
|
101
|
-
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.
|
101
|
+
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.4"])
|
102
102
|
s.add_dependency(%q<webrat>, [">= 0.7.0"])
|
103
103
|
end
|
104
104
|
end
|
metadata
CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
|
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- beta
|
10
|
-
-
|
11
|
-
version: 2.0.0.beta.
|
10
|
+
- 4
|
11
|
+
version: 2.0.0.beta.4
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- David Chelimsky
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-03-
|
20
|
+
date: 2010-03-15 00:00:00 -05:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -32,8 +32,8 @@ dependencies:
|
|
32
32
|
- 0
|
33
33
|
- 0
|
34
34
|
- beta
|
35
|
-
-
|
36
|
-
version: 2.0.0.beta.
|
35
|
+
- 4
|
36
|
+
version: 2.0.0.beta.4
|
37
37
|
type: :runtime
|
38
38
|
version_requirements: *id001
|
39
39
|
- !ruby/object:Gem::Dependency
|
@@ -115,7 +115,7 @@ licenses: []
|
|
115
115
|
post_install_message: |
|
116
116
|
**************************************************
|
117
117
|
|
118
|
-
Thank you for installing rspec-rails-2.0.0.beta.
|
118
|
+
Thank you for installing rspec-rails-2.0.0.beta.4!
|
119
119
|
|
120
120
|
This version of rspec-rails only works with
|
121
121
|
versions of rails >= 3.0.0.pre.
|
@@ -152,6 +152,6 @@ rubyforge_project: rspec
|
|
152
152
|
rubygems_version: 1.3.6
|
153
153
|
signing_key:
|
154
154
|
specification_version: 3
|
155
|
-
summary: rspec-rails-2.0.0.beta.
|
155
|
+
summary: rspec-rails-2.0.0.beta.4
|
156
156
|
test_files: []
|
157
157
|
|