Browse files

words

  • Loading branch information...
1 parent e4cbe22 commit 8b32de78a3a3180ab753efab98af516303e5c97c @dchelimsky dchelimsky committed Feb 15, 2010
View
24 README.markdown
@@ -8,18 +8,13 @@ either rspec or rails.
### Current state
-Currently in super-pre-alpha state - explore at your own risk!
+Currently in alpha - some things work, some not so much - see Known Issues,
+below
Install:
gem install rspec-rails --pre
-Build from source and install:
-
- git clone git://github.com/rspec/rspec-dev
- cd rspec-dev
- rake
-
This installs the following gems:
* rspec
@@ -28,6 +23,21 @@ This installs the following gems:
* rspec-mocks
* rspec-rails
+Configure:
+
+Add this line to the Gemfile:
+
+ gem "rspec-rails", ">= 2.0.0.a6"
+
+This will expose generators, including rspec:install. Once you run that:
+
+ script/rails g rspec:install
+
+... you'll have the spec task added to your rake tasks.
+
+Note that things are in flux, so some generators generate code that
+doesn't work all that well yet.
+
### What works (and what doesn't)
Currently supported:
View
2 lib/generators/rspec/controller/controller_generator.rb
@@ -7,7 +7,7 @@ class ControllerGenerator < Base
class_option :template_engine, :desc => "Template engine to generate view files"
class_option :controllers, :type => :boolean, :default => true
- class_option :views, :type => :boolean, :default => false
+ class_option :views, :type => :boolean, :default => true
def create_controller_files
return unless options[:controllers]
View
1 lib/generators/rspec/install/templates/config/initializers/rspec_generator.rb.tt
@@ -6,7 +6,6 @@
g.integration_tool :rspec
g.test_framework :rspec,
:fixture => false,
- :views => false,
:helpers => false,
:routes => false,
:integration => true
View
2 lib/generators/rspec/scaffold/scaffold_generator.rb
@@ -12,7 +12,7 @@ class ScaffoldGenerator < Base
class_option :singleton, :type => :boolean, :desc => "Supply to create a singleton controller"
class_option :controllers, :type => :boolean, :default => true
- class_option :views, :type => :boolean, :default => false
+ class_option :views, :type => :boolean, :default => true
class_option :routes, :type => :boolean, :default => false
def copy_controller_files
View
29 lib/rspec/rails/example/view_example_group.rb
@@ -0,0 +1,29 @@
+require 'webrat'
+
+module ViewExampleGroupBehaviour
+ include Webrat::Matchers
+
+ def assign(name, value)
+ assigns[name] = value
+ end
+
+ def assigns
+ @assigns ||= {}
+ end
+
+ def view
+ @view ||= ActionView::Base.new(ActionController::Base.view_paths, assigns)
+ end
+
+ def response
+ @response
+ end
+
+ def render
+ @response = view.render :file => running_example.metadata[:example_group][:description]
+ end
+
+ Rspec.configure do |c|
+ c.include self, :example_group => { :file_path => /\bspec\/views\// }
+ end
+end

0 comments on commit 8b32de7

Please sign in to comment.