rspec-rails 2.0.0.beta.15 → 2.0.0.beta.16

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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.beta.15
1
+ 2.0.0.beta.16
@@ -0,0 +1,12 @@
1
+ # Cucumber features
2
+
3
+ RSpec is specified using both RSpec and
4
+ [Cucumber](http://github.com/aslakhellesoy/cucumber). Cucumber provides
5
+ _executable documentation_. This means that the _.feature_ files below this
6
+ directory serve as specification, documentation _and_ regression tests of the
7
+ behaviour.
8
+
9
+ ## Issues
10
+
11
+ If you find this documentation incomplete or confusing, please [submit an
12
+ issue](http://github.com/rspec/rspec-rails/issues).
@@ -0,0 +1,38 @@
1
+ Feature: URL helpers in mailer examples
2
+
3
+ Scenario: using URL helpers with default options
4
+ Given a file named "config/initializers/mailer_defaults.rb" with:
5
+ """
6
+ Rails.configuration.action_mailer.default_url_options = { :host => 'example.com' }
7
+ """
8
+ And a file named "spec/mailers/notifications_spec.rb" with:
9
+ """
10
+ require 'spec_helper.rb'
11
+
12
+ describe Notifications do
13
+ it 'should have access to URL helpers' do
14
+ lambda { gadgets_url }.should_not raise_error
15
+ end
16
+ end
17
+ """
18
+ When I run "rspec spec"
19
+ Then I should see "1 example, 0 failures"
20
+
21
+ Scenario: using URL helpers without default options
22
+ Given a file named "config/initializers/mailer_defaults.rb" with:
23
+ """
24
+ # no default options
25
+ """
26
+ And a file named "spec/mailers/notifications_spec.rb" with:
27
+ """
28
+ require 'spec_helper.rb'
29
+
30
+ describe Notifications do
31
+ it 'should have access to URL helpers' do
32
+ lambda { gadgets_url :host => 'example.com' }.should_not raise_error
33
+ lambda { gadgets_url }.should raise_error
34
+ end
35
+ end
36
+ """
37
+ When I run "rspec spec"
38
+ Then I should see "1 example, 0 failures"
@@ -16,8 +16,8 @@ Feature: view spec
16
16
 
17
17
  render
18
18
 
19
- response.should contain("slicer")
20
- response.should contain("dicer")
19
+ rendered.should contain("slicer")
20
+ rendered.should contain("dicer")
21
21
  end
22
22
  end
23
23
  """
@@ -42,8 +42,8 @@ Feature: view spec
42
42
  it "displays both widgets" do
43
43
  render
44
44
 
45
- response.should contain("slicer")
46
- response.should contain("dicer")
45
+ rendered.should contain("slicer")
46
+ rendered.should contain("dicer")
47
47
  end
48
48
  end
49
49
  end
@@ -62,7 +62,7 @@ Feature: view spec
62
62
 
63
63
  render :template => "widgets/widget.html.erb"
64
64
 
65
- response.should contain("slicer")
65
+ rendered.should contain("slicer")
66
66
  end
67
67
  end
68
68
  """
@@ -84,7 +84,7 @@ Feature: view spec
84
84
 
85
85
  render :partial => "widgets/widget.html.erb", :locals => {:widget => widget}
86
86
 
87
- response.should contain("slicer")
87
+ rendered.should contain("slicer")
88
88
  end
89
89
  end
90
90
  """
@@ -106,7 +106,7 @@ Feature: view spec
106
106
 
107
107
  render "widgets/widget", :widget => widget
108
108
 
109
- response.should contain("slicer")
109
+ rendered.should contain("slicer")
110
110
  end
111
111
  end
112
112
  """
@@ -127,7 +127,7 @@ Feature: view spec
127
127
 
128
128
  render :text => "This is directly rendered"
129
129
 
130
- response.should contain("directly rendered")
130
+ rendered.should contain("directly rendered")
131
131
  end
132
132
  end
133
133
  """
@@ -146,7 +146,7 @@ Feature: view spec
146
146
  page.hide 'status-indicator'
147
147
  end
148
148
 
149
- response.should contain("Element.hide(\"status-indicator\")")
149
+ rendered.should contain("Element.hide(\"status-indicator\")")
150
150
  end
151
151
  end
152
152
  """
@@ -4,12 +4,12 @@ module Rspec
4
4
  module Generators
5
5
  class HelperGenerator < Base
6
6
  include Rails::Generators::ResourceHelpers
7
- class_option :helpers, :type => :boolean, :default => false
7
+ class_option :helpers, :type => :boolean, :default => true
8
8
 
9
9
  def create_helper_files
10
10
  return unless options[:helpers]
11
11
 
12
- template 'helper_spec.rb', File.join('spec/helpers', class_path, "#{file_name}_helper_spec.rb")
12
+ template 'helper_spec.rb', File.join('spec/helpers', class_path, "#{table_name}_helper_spec.rb")
13
13
  end
14
14
  end
15
15
  end
@@ -37,7 +37,7 @@ module Rspec
37
37
  return unless options[:helper_specs]
38
38
 
39
39
  template "helper_spec.rb",
40
- File.join('spec/helpers', "#{controller_file_name}_helper_spec.rb")
40
+ File.join('spec/helpers', controller_class_path, "#{controller_file_name}_helper_spec.rb")
41
41
 
42
42
  end
43
43
 
@@ -45,7 +45,7 @@ module Rspec
45
45
  return unless options[:routing_specs]
46
46
 
47
47
  template 'routing_spec.rb',
48
- File.join('spec/routing', "#{controller_file_name}_routing_spec.rb")
48
+ File.join('spec/routing', controller_class_path, "#{controller_file_name}_routing_spec.rb")
49
49
  end
50
50
 
51
51
  hook_for :integration_tool, :as => :integration
@@ -1,18 +1,26 @@
1
- module RSpec::Rails
2
- module MailerExampleGroup
3
- extend ActiveSupport::Concern
4
- extend RSpec::Rails::ModuleInclusion
1
+ if defined?(ActionMailer)
2
+ module RSpec::Rails
3
+ module MailerExampleGroup
4
+ extend ActiveSupport::Concern
5
+ extend RSpec::Rails::ModuleInclusion
5
6
 
6
- include ActionMailer::TestCase::Behavior
7
- include Webrat::Matchers
8
- include RSpec::Matchers
7
+ include ActionMailer::TestCase::Behavior
8
+ include Webrat::Matchers
9
+ include RSpec::Matchers
9
10
 
10
- module ClassMethods
11
- def mailer_class
12
- describes
11
+ included do
12
+ include ::Rails.application.routes.url_helpers
13
+ options = ::Rails.configuration.action_mailer.default_url_options
14
+ options.each { |key, value| default_url_options[key] = value } if options
15
+ end
16
+
17
+ module ClassMethods
18
+ def mailer_class
19
+ describes
20
+ end
13
21
  end
14
- end
15
22
 
16
- RSpec.configure &include_self_when_dir_matches('spec','mailers')
23
+ RSpec.configure &include_self_when_dir_matches('spec','mailers')
24
+ end
17
25
  end
18
26
  end
@@ -132,12 +132,7 @@ module RSpec
132
132
  returning model_class.new do |m|
133
133
  m.id = stubs.delete(:id)
134
134
  m.extend ModelStubber
135
- stubs.each do |k,v|
136
- if m.has_attribute?(k)
137
- m[k] = stubs.delete(k)
138
- end
139
- end
140
- m.stub!(stubs)
135
+ m.stub(stubs)
141
136
  yield m if block_given?
142
137
  end
143
138
  end
@@ -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.15"
8
+ s.version = "2.0.0.beta.16"
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-06-30}
12
+ s.date = %q{2010-07-06}
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 = [
@@ -25,9 +25,11 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "autotest/discover.rb",
27
27
  "cucumber.yml",
28
+ "features/README.markdown",
28
29
  "features/controller_specs/isolation_from_views.feature",
29
30
  "features/controller_specs/readers.feature",
30
31
  "features/controller_specs/render_views.feature",
32
+ "features/mailer_specs/url_helpers.feature",
31
33
  "features/matchers/be_routable_matcher.feature",
32
34
  "features/matchers/new_record_matcher.feature",
33
35
  "features/model_specs/errors_on.feature",
@@ -119,7 +121,7 @@ Gem::Specification.new do |s|
119
121
  s.homepage = %q{http://github.com/rspec/rspec-rails}
120
122
  s.post_install_message = %q{**************************************************
121
123
 
122
- Thank you for installing rspec-rails-2.0.0.beta.15!
124
+ Thank you for installing rspec-rails-2.0.0.beta.16!
123
125
 
124
126
  This version of rspec-rails only works with
125
127
  versions of rails >= 3.0.0.pre.
@@ -138,7 +140,7 @@ Gem::Specification.new do |s|
138
140
  s.require_paths = ["lib"]
139
141
  s.rubyforge_project = %q{rspec}
140
142
  s.rubygems_version = %q{1.3.7}
141
- s.summary = %q{rspec-rails-2.0.0.beta.15}
143
+ s.summary = %q{rspec-rails-2.0.0.beta.16}
142
144
  s.test_files = [
143
145
  "spec/rspec/rails/example/controller_example_group_spec.rb",
144
146
  "spec/rspec/rails/example/helper_example_group_spec.rb",
@@ -2,6 +2,13 @@ require "spec_helper"
2
2
 
3
3
  module RSpec::Rails
4
4
  describe MailerExampleGroup do
5
+
6
+ module ::Rails; end
7
+ before do
8
+ Rails.stub_chain(:application, :routes, :url_helpers).and_return(Rails)
9
+ Rails.stub_chain(:configuration, :action_mailer, :default_url_options).and_return({})
10
+ end
11
+
5
12
  it { should be_included_in_files_in('./spec/mailers/') }
6
13
  it { should be_included_in_files_in('.\\spec\\mailers\\') }
7
14
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196477
4
+ hash: 62196419
5
5
  prerelease: true
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
9
  - 0
10
10
  - beta
11
- - 15
12
- version: 2.0.0.beta.15
11
+ - 16
12
+ version: 2.0.0.beta.16
13
13
  platform: ruby
14
14
  authors:
15
15
  - David Chelimsky
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-06-30 00:00:00 -05:00
21
+ date: 2010-07-06 00:00:00 -05:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -73,9 +73,11 @@ files:
73
73
  - VERSION
74
74
  - autotest/discover.rb
75
75
  - cucumber.yml
76
+ - features/README.markdown
76
77
  - features/controller_specs/isolation_from_views.feature
77
78
  - features/controller_specs/readers.feature
78
79
  - features/controller_specs/render_views.feature
80
+ - features/mailer_specs/url_helpers.feature
79
81
  - features/matchers/be_routable_matcher.feature
80
82
  - features/matchers/new_record_matcher.feature
81
83
  - features/model_specs/errors_on.feature
@@ -170,7 +172,7 @@ licenses: []
170
172
  post_install_message: |
171
173
  **************************************************
172
174
 
173
- Thank you for installing rspec-rails-2.0.0.beta.15!
175
+ Thank you for installing rspec-rails-2.0.0.beta.16!
174
176
 
175
177
  This version of rspec-rails only works with
176
178
  versions of rails >= 3.0.0.pre.
@@ -215,7 +217,7 @@ rubyforge_project: rspec
215
217
  rubygems_version: 1.3.7
216
218
  signing_key:
217
219
  specification_version: 3
218
- summary: rspec-rails-2.0.0.beta.15
220
+ summary: rspec-rails-2.0.0.beta.16
219
221
  test_files:
220
222
  - spec/rspec/rails/example/controller_example_group_spec.rb
221
223
  - spec/rspec/rails/example/helper_example_group_spec.rb