[Rails] rspec-mocks and rspec-rails-2.10.1 are released!

2012-05-04 Thread David Chelimsky
These are patch releases recommended for anybody who has already
upgraded to 2.10.

### rspec-mocks-2.10.1
full changelog: http://github.com/rspec/rspec-mocks/compare/v2.10.0...v2.10.1

Bug fixes

* fix [regression of edge case
behavior](https://github.com/rspec/rspec-mocks/issues/132)
* fixed failure of
`object.should_receive(:message).at_least(0).times.and_return value`
* fixed failure of `object.should_not_receive(:message).and_return value`

### rspec-rails-2.10.1
full changelog: http://github.com/rspec/rspec-rails/compare/v2.10.0...v2.10.1

Bug fixes

* fix [regression introduced in 2.10.0 that broke integration with
Devise](https://github.com/rspec/rspec-rails/issues/534)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-expectations-2.9.1 is released!

2012-04-03 Thread David Chelimsky
rspec-expectations-2.9.1 is released!

This is a bug-fix only release, and is recommended for everybody using 
rspec-2.9.

### rspec-expectations-2.9.1 / 2012-04-03
[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.0...2.9.1)

Bug fixes

* Provide a helpful message if the diff between two objects is empty.
* Fix bug diffing single strings with multiline strings.
* Fix for error with using custom matchers inside other custom matchers
 (mirasrael)
* Fix using execution context methods in nested DSL matchers (mirasrael)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] rspec: mocking a reference to a polymorphic model?

2012-03-29 Thread David Chelimsky
On Thu, Mar 22, 2012 at 7:23 AM, Fearless Fool  wrote:
> The basic question: how do you mock (or stub) a reference to a
> polymorphic class in RSpec?  Trying the obvious thing leads to an error
> of the form:
>
>   undefined method `base_class' for Post:Class
>
> === The details:
>
> # file: app/models/relation.rb
> class Relation < ActiveRecord::Base
>  belongs_to :entity, :polymorphic => true
> end
>
> # file: db/xxx_create_relations.rb
> class CreateRelations < ActiveRecord::Migration
>  def change
>    create_table :relations do |t|
>      t.references :entity, :polymorphic => true, :null => false
>    end
>  end
> end
>
> # file: spec/models/relation_spec.rb
> describe Relation do
>  it 'should create instance without error' do
>    post = mock_model("Post")
>    lambda { Relation.create!(:entity => @post)}.should_not raise_error
>  end
> end
>
> === Running the test:
>
>  1) Relation should create instance without error
>     Failure/Error: lambda { Relation.create!(:entity => post)
> }.should_not raise_error
>       expected no Exception, got # `base_class' for Post:Class>
>     # ./spec/models/relation_spec.rb:39:in `block (2 levels) in  (required)>'
>
> My hunch is that ActiveRecord is calling base_class on the mocked model
> (Post) to determine what to stick in the 'entity_type' column in the
> relations table.  I tried explicitly setting it, as in:
>
>    post = mock_model("Post", :base_class => "Post")
>
> but the error was the same.
>
> For all the reasons that DC espouses, I'd love to mock (or stub)
> references to the polymorphic models, but I don't see how to do that.
> Any ideas?

I don't espouse stubbing or mocking associations, as it requires
knowledge of Rails internals (as in your example). I do espouse
stubbing domain-specific APIs on models in controller specs, because
that provides fine-grained control of state and decoupling from the
database, but that is an entirely different matter/context.

HTH,
David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Best place for RSpec/Rails questions?

2012-03-29 Thread David Chelimsky
On Thu, Mar 22, 2012 at 1:12 PM, Pito Salas  wrote:
> I've tried a question on StackOverflow and on
> http://www.ruby-forum.com/forum/rspec. Are those the best sources for
> rspec-in-rails questions, or should I post in the Rails forum itself?
> Anyone have an opinion?

http://rubyforge.org/mailman/listinfo/rspec-users
mirror: http://groups.google.com/group/rspec

HTH,
David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.9.0 is released!

2012-03-17 Thread David Chelimsky
rspec-2.9.0 is released wtih lots of bug fixes and a few minor feature 
improvements as well. Enjoy!

### rspec-core-2.9.0 / 2012-03-17
[full changelog](http://github.com/rspec/rspec-core/compare/v2.8.0...v2.9.0)

Enhancements

* Support for "X minutes X seconds" spec run duration in formatter. (uzzz)
* Strip whitespace from group and example names in doc formatter.
* Removed spork-0.9 shim. If you're using spork-0.8.x, you'll need to upgrade
  to 0.9.0.

Bug fixes

* Restore `--full_backtrace` option
* Ensure that values passed to `config.filter_run` are respected when running
  over DRb (using spork).
* Ensure shared example groups are reset after a run (as example groups are).
* Remove `rescue false` from calls to filters represented as Procs
* Ensure described_class gets the closest constant (pyromaniac)
* In "autorun", don't run the specs in the at_exit hook if there was an
  exception (most likely due to a SyntaxError). (sunaku)
* Don't extend groups with modules already used to extend ancestor groups.
* `its` correctly memoizes nil or false values (Yamada Masaki)

### rspec-expectations-2.9.0 / 2012-03-17
[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0...v2.9.0)

Enhancements

* Move built-in matcher classes to RSpec::Matchers::BuiltIn to reduce pollution
  of RSpec::Matchers (which is included in every example).
* Autoload files with matcher classes to improve load time.

Bug fixes

* Align `respond_to?` and `method_missing` in DSL-defined matchers.
* Clear out user-defined instance variables between invocations of DSL-defined
  matchers.
* Dup the instance of a DSL generated matcher so its state is not changed by
  subsequent invocations.
* Treat expected args consistently across positive and negative expectations
  (thanks to Ralf Kistner for the heads up)

### rspec-mocks-2.9.0 / 2012-03-17
[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.0...v2.9.0)

Enhancements

* Support order constraints across objects (preethiramdev)

Bug fixes

* Allow a `as_null_object` to be passed to `with`
* Pass proc to block passed to stub (Aubrey Rhodes)
* Initialize child message expectation args to match any args (#109 -
  preethiramdev)

### rspec-rails-2.9.0 / 2012-03-17
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.8.1...v2.9.0)

Enhancments

* add description method to RouteToMatcher (John Wulff)
* Run "db:test:clone_structure" instead of "db:test:prepare" if Active Record's
  schema format is ":sql". (Andrey Voronkov)

Bug fixes

* `mock_model(XXX).as_null_object.unknown_method` returns self again
* Generated view specs use different IDs for each attribute.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: rspec-2.9.0.rc1 is released!

2012-03-12 Thread David Chelimsky
There was an error in one of the gemspecs so I just released
2.9.0.rc2. No other changes since rc1.

Cheers,
David

On Sun, Mar 11, 2012 at 9:10 PM, David Chelimsky  wrote:
> rspec-2.9.0.rc1 has been released, with numerous enhancements and bug fixes:
>
> ### rspec-core-2.9.0.rc1 / 2012-03-11
> [full 
> changelog](http://github.com/rspec/rspec-core/compare/v2.8.0...v2.9.0.rc1)
>
> Enhancements
>
> * Support for "X minutes X seconds" spec run duration in formatter. (uzzz)
> * Strip whitespace from group and example names in doc formatter.
> * Removed spork-0.9 shim. If you're using spork-0.8.x, you'll need to upgrade
>  to 0.9.0.
>
> Bug fixes
>
> * Restore `--full_backtrace` option
> * Ensure that values passed to `config.filter_run` are respected when running
>  over DRb (using spork).
> * Ensure shared example groups are reset after a run (as example groups are).
> * Remove `rescue false` from calls to filters represented as Procs
> * Ensure described_class gets the closest constant (pyromaniac)
> * In "autorun", don't run the specs in the at_exit hook if there was an
>  exception (most likely due to a SyntaxError). (sunaku)
> * Don't extend groups with modules already used to extend ancestor groups.
>
>
> ### rspec-expectations-2.9.0.rc1 / 2012-03-11
> [full 
> changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0...v2.9.0.rc1)
>
> Enhancements
>
> * Move built-in matcher classes to RSpec::Matchers::BuiltIn to reduce 
> pollution
>  of RSpec::Matchers (which is included in every example).
> * Autoload files with matcher classes to improve load time.
>
> Bug fixes
>
> * Align respond_to? and method_missing in DSL-defined matchers.
> * Clear out user-defined instance variables between invocations of DSL-defined
>  matchers.
> * Dup the instance of a DSL generated matcher so its state is not changed by
>  subsequent invocations.
> * Treat expected args consistently across positive and negative expectations
>  (thanks to Ralf Kistner for the heads up)
>
>
> ### rspec-mocks-2.9.0.rc1 / 2012-03-11
> [full 
> changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.0...v2.9.0.rc1)
>
> Enhancements
>
> * Support order constraints across objects (preethiramdev)
>
> Bug fixes
>
> * Allow a `as_null_object` to be passed to `with`
> * Pass proc to block passed to stub (Aubrey Rhodes)
> * Initialize child message expectation args to match any args (#109 -
>  preethiramdev)
>
>
> ### rspec-rails-2.9.0.rc1 / 2012-03-11
> [full 
> changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.1...v2.9.0.rc1)
>
> Enhancments
>
> * add description method to RouteToMatcher (John Wulff)
> * Run "db:test:clone_structure" instead of "db:test:prepare" if Active 
> Record's
>  schema format is ":sql". (Andrey Voronkov)
>
> Bug fixes
>
> * mock_model(XXX).as_null_object.unknown_method returns self again
> * Generated view specs use different IDs for each attribute.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.9.0.rc1 is released!

2012-03-11 Thread David Chelimsky
rspec-2.9.0.rc1 has been released, with numerous enhancements and bug fixes:

### rspec-core-2.9.0.rc1 / 2012-03-11
[full changelog](http://github.com/rspec/rspec-core/compare/v2.8.0...v2.9.0.rc1)

Enhancements

* Support for "X minutes X seconds" spec run duration in formatter. (uzzz)
* Strip whitespace from group and example names in doc formatter.
* Removed spork-0.9 shim. If you're using spork-0.8.x, you'll need to upgrade
  to 0.9.0.

Bug fixes

* Restore `--full_backtrace` option
* Ensure that values passed to `config.filter_run` are respected when running
  over DRb (using spork).
* Ensure shared example groups are reset after a run (as example groups are).
* Remove `rescue false` from calls to filters represented as Procs
* Ensure described_class gets the closest constant (pyromaniac)
* In "autorun", don't run the specs in the at_exit hook if there was an
  exception (most likely due to a SyntaxError). (sunaku)
* Don't extend groups with modules already used to extend ancestor groups.


### rspec-expectations-2.9.0.rc1 / 2012-03-11
[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0...v2.9.0.rc1)

Enhancements

* Move built-in matcher classes to RSpec::Matchers::BuiltIn to reduce pollution
  of RSpec::Matchers (which is included in every example).
* Autoload files with matcher classes to improve load time.

Bug fixes

* Align respond_to? and method_missing in DSL-defined matchers.
* Clear out user-defined instance variables between invocations of DSL-defined
  matchers.
* Dup the instance of a DSL generated matcher so its state is not changed by
  subsequent invocations.
* Treat expected args consistently across positive and negative expectations
  (thanks to Ralf Kistner for the heads up)


### rspec-mocks-2.9.0.rc1 / 2012-03-11
[full 
changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.0...v2.9.0.rc1)

Enhancements

* Support order constraints across objects (preethiramdev)

Bug fixes

* Allow a `as_null_object` to be passed to `with`
* Pass proc to block passed to stub (Aubrey Rhodes)
* Initialize child message expectation args to match any args (#109 -
  preethiramdev)


### rspec-rails-2.9.0.rc1 / 2012-03-11
[full 
changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.1...v2.9.0.rc1)

Enhancments

* add description method to RouteToMatcher (John Wulff)
* Run "db:test:clone_structure" instead of "db:test:prepare" if Active Record's
  schema format is ":sql". (Andrey Voronkov)

Bug fixes

* mock_model(XXX).as_null_object.unknown_method returns self again
* Generated view specs use different IDs for each attribute.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Bundler ignoring rspec

2011-10-30 Thread David Chelimsky


On Oct 30, 3:44 pm, Leonardo Mateo  wrote:
> On Sun, Oct 30, 2011 at 5:07 PM, Leonardo Mateo  
> wrote:
> > On Sun, Oct 30, 2011 at 2:59 PM, David Chelimsky  
> > wrote:
> >> On Oct 30, 12:09 pm, Leonardo Mateo  wrote:
> >>> Hi guys,
> >>> I'm having a problem that's driving me nuts.
> >>> I have a rails 3.1.1 project in which bundler is ignoring RSpec, no
> >>> matter what I set rspec or rspec-rails it never gets installed.
>
> >> What is the specific behavior you're not seeing? i.e. do you really
> >> mean it never gets installed (as in you can type "gem list rspec" and
> >> nothing shows up) or do you mean that you don't see it's rake tasks or
> >> something else?
> > It doesn't get installed at all.
> > I don't know why, since in another project with the same ruby version
> > (1.9.3-rc1 until today) it is working.
> > "gem list rspec" does not show any gem listed, and "bundle | grep
> > rspec" gives nothing.
>
> >> As a starting point, I just created a new rvm gemset, installed rails
> >> 3.1.1, ran "rails new example", copied the Gemfile you list below, and
> >> ran bundle install. It installed rspec-rails and the other rspec gems
> >> as expected.
>
> >> I then ran "rails generate rspec:install" and got an error on ffi
> >> having to do with the rb-inotify gem, so I removed that and libnotify
> >> (gem) and tried again and it worked. I was able to generate a model
> >> with a spec, and run it using the 'rspec' or 'rake spec' commands.
> > I tried it too, I removed the gemset, then created a new empty one and
> > ran "bundle install". I've even installed ruby 1.9.3-p0 today, started
> > a new gemset from scratch and I had the same behavior.
>
> >> Other relevant info: mac os 10.7.2 (lion), rvm 1.9.1, ruby 1.9.2.
> > I'm using Arch Linux. rvm 1.9.1, ruby 1.9.3-p0
>
> > It looks like something is wrong with this specific project, but I
> > can't tell what it is.
> > I really don't know either what I can do to fix it. I can't just re
> > create it, since I already have a lot of work done.
>
> It looks like the problem is with the groups.
> Nothing listed within the "group :test, :development {}" gets
> installed. Still don't know why.

What's in .bundle/config? Look for "BUNDLE_WITHOUT: development" and/
or "BUNDLE_WITHOUT: test"

>
> --
> Leonardo Mateo.
> There's no place like ~

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Bundler ignoring rspec

2011-10-30 Thread David Chelimsky
On Oct 30, 12:09 pm, Leonardo Mateo  wrote:
> Hi guys,
> I'm having a problem that's driving me nuts.
> I have a rails 3.1.1 project in which bundler is ignoring RSpec, no
> matter what I set rspec or rspec-rails it never gets installed.

What is the specific behavior you're not seeing? i.e. do you really
mean it never gets installed (as in you can type "gem list rspec" and
nothing shows up) or do you mean that you don't see it's rake tasks or
something else?

As a starting point, I just created a new rvm gemset, installed rails
3.1.1, ran "rails new example", copied the Gemfile you list below, and
ran bundle install. It installed rspec-rails and the other rspec gems
as expected.

I then ran "rails generate rspec:install" and got an error on ffi
having to do with the rb-inotify gem, so I removed that and libnotify
(gem) and tried again and it worked. I was able to generate a model
with a spec, and run it using the 'rspec' or 'rake spec' commands.

Other relevant info: mac os 10.7.2 (lion), rvm 1.9.1, ruby 1.9.2.

HTH,
David

> I've tried bundler 1.0.21 and bundler pre.
> Any clue would be very much appreciated.
>
> Thaks a lot in advance.
>
> This is my Gemfile
>
> source 'http://rubygems.org'
>
> gem 'rails', '3.1.1'
>
> # Gems used only for assets and not required
> # in production environments by default.
> group :assets do
>   gem 'sass-rails', "~> 3.1.0.rc"
>   gem 'coffee-rails', "~> 3.1.0.rc"
>   gem 'uglifier'
> end
>
> gem 'json'
> gem 'jquery-rails'
> gem 'haml-rails'
> gem 'compass', '>= 0.11.5'
> gem 'omniauth', '>=0.3.0'
> gem 'kaminari'
> gem 'bcrypt-ruby'
> gem 'exception_notification'
> gem 'execjs'
> gem 'therubyracer'
> #group :development do
>   ##gem 'ruby-debug19'
> #end
>
> group :test, :development do
>   gem 'sqlite3'
>   # Pretty printed test output
>   gem 'rb-inotify'
>   gem 'libnotify'
>   gem 'rspec-rails'
>   gem 'guard-rspec'
>   gem 'capybara'
>   gem 'summoner'
>   gem 'wirble'
>   gem 'hirb'
>   gem 'interactive_editor'
> end
>
> group :production do
>   gem 'pg'
> end
>
> --
> Leonardo Mateo.
> There's no place like ~

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-core 2.7.1 is released!

2011-10-20 Thread David Chelimsky
rspec-core 2.7.1 is released!

### rspec-core-2.7.1 / 2011-10-20

[full changelog](http://github.com/rspec/rspec-core/compare/v2.7.0...v2.7.1)

* Bug fixes
  * tell autotest the correct place to find the rspec executable

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec 2.7.0 is released!

2011-10-16 Thread David Chelimsky
We're pleased to announce the release of rspec-2.7.0. Release notes for each
gem are listed below, but here are a couple of highlights:

## Just type `rspec`

With the the 2.7.0 release, if you keep all of your specs in the conventional
`spec` directory, you don't need to follow the `rspec` command with a path.
Just type `rspec`.

If you keep your specs in a different directory, just set the `--default_path`
option to that directory on the command line, or in a `.rspec` config file.

## The rake task now lets Bundler manage Bundler

The `RSpec::Core::RakeTask` invokes the `rspec` command in a subshell. In
recent releases, it assumed that you wanted it prefixed with `bundle exec` if
it saw a `Gemfile`. We then added `gemfile` and `skip_bundler` options to the
task, so you could manage this in different ways.

It turns out that Bundler manages this quite well without any help from RSpec.
If you activate Bundler in the parent shell, via the command line or
`Bundler.setup`, it sets environment variables that activate Bundler in the
subshell with the correct gemfile.

The `gemfile` and `skip_bundler` options are therefore deprecated and have no
effect.

## Release Notes

### rspec-core-2.7.0

[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.4...v2.7.0)

NOTE: RSpec's release policy dictates that there should not be any backward
incompatible changes in minor releases, but we're making an exception to
release a change to how RSpec interacts with other command line tools.

As of 2.7.0, you must explicity `require "rspec/autorun"` unless you use the
`rspec` command (which already does this for you).

* Enhancements
  * Add example.exception (David Chelimsky)
  * `--default_path` command line option (Justin Ko)
  * support multiple `--line_number` options (David J. Hamilton)
  * also supports `path/to/file.rb:5:9` (runs examples on lines 5 and 9)
  * Allow classes/modules to be used as shared example group identifiers
(Arthur Gunn)
  * Friendly error message when shared context cannot be found (Sławosz
Sławiński)
  * Clear formatters when resetting config (John Bintz)
  * Add `xspecify` and xexample as temp-pending methods (David Chelimsky)
  * Add `--no-drb` option (Iain Hecker)
  * Provide more accurate run time by registering start time before code
is loaded (David Chelimsky)
  * Rake task default pattern finds specs in symlinked dirs (Kelly Felkins)
  * Rake task no longer does anything to invoke bundler since Bundler already
handles it for us. Thanks to Andre Arko for the tip.
  * Add `--failure-exit-code` option (Chris Griego)

* Bug fixes
  * Include `Rake::DSL` to remove deprecation warnings in Rake > 0.8.7 (Pivotal
Casebook)
  * Only eval `let` block once even if it returns `nil` (Adam Meehan)
  * Fix `--pattern` option (wasn't being recognized) (David Chelimsky)
  * Only implicitly `require "rspec/autorun"` with the `rspec` command (David
Chelimsky)
  * Ensure that rspec's `at_exit` defines the exit code (Daniel Doubrovkine)
  * Show the correct snippet in the HTML and TextMate formatters (Brian
Faherty)

### rspec-expectations-2.7.0

[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.6.0...v2.7.0)

* Enhancements
  * HaveMatcher converts argument using `to_i` (Alex Bepple & Pat Maddox)
  * Improved failure message for the `have_xxx` matcher (Myron Marston)
  * HaveMatcher supports `count` (Matthew Bellantoni)
  * Change matcher dups `Enumerable` before the action, supporting custom
`Enumerable` types like `CollectionProxy` in Rails (David Chelimsky)

* Bug fixes
  * Fix typo in `have(n).xyz` documentation (Jean Boussier)
  * fix `safe_sort` for ruby 1.9.2 (`Kernel` now defines `<=>` for Object)
(Peter van Hardenberg)

### rspec-mocks-2.7.0

[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.6.0...v2.7.0)

* Enhancements
  * Use `__send__` rather than `send` (alextk) 
  * Add support for `any_instance.stub_chain` (Sidu Ponnappa)
  * Add support for `any_instance` argument matching based on `with` (Sidu
Ponnappa and Andy Lindeman)

* Changes
  * Check for `failure_message_for_should` or `failure_message` instead of
`description` to detect a matcher (Tibor Claassen)

* Bug fixes
  * pass a hash to `any_instance.stub`. (Justin Ko)
  * allow `to_ary` to be called without raising `NoMethodError` (Mikhail
Dieterle)
  * `any_instance` properly restores private methods (Sidu Ponnappa)

### rspec-rails-2.7.0

[full changelog](http://github.com/rspec/rspec-rails/compare/v2.6.1...v2.7.0)

* Enhancments
  * `ActiveRecord::Relation` can use the `=~` matcher (Andy Lindeman)
  * Make generated controller spec more consistent with regard to ids
(Brent J. Nordquist)
  * Less restrictive autotest mapping between spec and implementation files
(José Valim)
  * `require 'rspec/autorun'` from generated `spec_helper.rb` (David Chelimsky)
  * ad

[Rails] rspec 2.7.0.rc1 is released!

2011-10-09 Thread David Chelimsky
rspec 2.7.0.rc1 is released!

This includes the following (see the changelog for each lib below):

rspec-2.7.0.rc1
rspec-core-2.7.0.rc1
rspec-expectations-2.7.0.rc1
rspec-mocks-2.7.0.rc1
rspec-rails-2.7.0.rc1

Please direct any questions or issues to the github issues tracker for each 
repository or http://rubyforge.org/mailman/listinfo/rspec-users.

Enjoy!

David

### rspec-core-2.7.0.rc1

full changelog: http://github.com/rspec/rspec-core/compare/v2.6.4...v2.7.0.rc1

NOTE: RSpec's release policy dictates that there should not be any backward
incompatible changes in minor releases, but we're making an exception to
release a change to how RSpec interacts with other command line tools.

As of 2.7.0, you must explicity `require "rspec/autorun"` unless you use the
`rspec` command (which already does this for you).

* Enhancements
  * Add example.exception (David Chelimsky)
  * --default_path command line option (Justin Ko)
  * support multiple --line_number options (David J. Hamilton)
  * also supports path/to/file.rb:5:9 (runs examples on lines 5 and 9)
  * Allow classes/modules to be used as shared example group identifiers
(Arthur Gunn)
  * Friendly error message when shared context cannot be found (Sławosz
Sławiński)
  * Clear formatters when resetting config (John Bintz)
  * Add xspecify and xexample as temp-pending methods (David Chelimsky)
  * Add --no-drb option (Iain Hecker)
  * Provide more accurate run time by registering start time before code
    is loaded (David Chelimsky)
  * Rake task default pattern finds specs in symlinked dirs (Kelly Felkins)
  * Rake task decides whether to use bundler or not based on presence
    of BUNDLE_GEMFILE (David Chelimsky)

* Bug fixes
  * Include Rake::DSL to remove deprecation warnings in Rake > 0.8.7 (Pivotal
Casebook)
  * Only eval `let` block once even if it returns `nil` (Adam Meehan)
  * Fix --pattern option (wasn't being recognized) (David Chelimsky)
  * Only implicitly require "rspec/autorun" with the `rspec` command (David
Chelimsky)
  * Ensure that rspec's at_exit defines the exit code (Daniel Doubrovkine)
  * Show the correct snippet in the HTML and TextMate formatters (Brian
Faherty)

### rspec-expectations-2.7.0.rc1

full changelog: 
http://github.com/rspec/rspec-expectations/compare/v2.6.0...v2.7.0.rc1

* Enhancements
  * HaveMatcher converts argument using #to_i (Alex Bepple & Pat Maddox)
  * Improved failure message for the have_xxx matcher (Myron Marston)
  * HaveMatcher supports #count (Matthew Bellantoni)
  * Change matcher dups Enumerable before the action, supporting custom
Enumerable types like CollectionProxy in Rails (David Chelimsky)

* Bug fixes
  * Fix typo in have(n).xyz documentation (Jean Boussier)
  * fix safe_sort for ruby 1.9.2 (Kernel now defines <=> for Object) (Peter van 
Hardenberg)

### rspec-mocks-2.7.0.rc1

full changelog: http://github.com/rspec/rspec-mocks/compare/v2.6.0...v2.7.0.rc1

* Enhancements
  * Use `__send__` rather than `send` (alextk) 
  * Add support for any_instance.stub_chain (Sidu Ponnappa)
  * Add support for any_instance argument matching based on `with` (Sidu
Ponnappa and Andy Lindeman)

* Changes
  * Check for #failure_message_for_should or #failure_message instead of
#description to detect a matcher (Tibor Claassen)

* Bug fixes
  * pass a hash to `any_instance.stub`. (Justin Ko)
  * allow :to_ary to be called without raising NoMethodError (Mikhail Dieterle)

### rspec-rails-2.7.0.rc1

full changelog: http://github.com/rspec/rspec-rails/compare/v2.6.1...v2.7.0.rc1

* Enhancments
  * ActiveRecord::Relation can use the "=~" matcher (Andy Lindeman)
  * Make generated controller spec more consistent with regard to ids
(Brent J. Nordquist)
  * Less restrictive autotest mapping between spec and implementation files
(José Valim)
  * require 'rspec/autorun' from generated spec_helper.rb (David Chelimsky)
  * bypass_rescue (Lenny Marks)
  * route_to accepts query string (Marc Weil)

* Internal
  * Added specs for generators using ammeter (Alex Rothenberg)

* Bug fixes
  * Fix configuration/integration bug with rails 3.0 (fixed in 3.1) in which
fixure_file_upload reads from ActiveSupport::TestCase.fixture_path and 
misses
RSpec's configuration (David Chelimsky)
  * Support nested resource in view spec generator (David Chelimsky)
  * Define `primary_key` on class generated by mock_model("WithAString") (David
Chelimsky)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: How do I generate the Rspec file for an already existing model in Rails 3?

2011-08-22 Thread David Chelimsky
On Aug 22, 2:18 pm, Ezequiel Schwartzman  wrote:
> I've seen guides for Rspec that say to use rspec_model script, but in
> Rails 3 you don't have the script folder, and the only Rspec generator
> that I have is rspec:install.
>
> The other way is generate them automatically when scaffolding, but I
> already have the model, controller and view files created =/

  rails generate model my_model_that_already_exists --skip-migration

It will ask you if you want to overwrite the existing model file. Say
no.

HTH,
David


>
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: have_selector syntax?

2011-07-26 Thread David Chelimsky
On Jul 26, 9:51 am, 7stud --  wrote:
> Where are the docs for have_selector()?
> rspec-rails 2.6.1
> rails 3.0.9

have_selector comes from capybara. I don't see docs for it, but there
is some helpful info if you google "capybara have_selector"

HTH,
David


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: What does using a lambda in rspec tests accomplish?

2011-07-25 Thread David Chelimsky


On Jul 25, 6:40 pm, 7stud --  wrote:
> John Feminella wrote in post #1012869:
>
> > In other words, it
> > needs a "before" to start with and an "after" to compare to. With a
> > lambda, this is accomplished by measuring the thing you want to check
> > before the lambda is run, and then again after it's run.
>
> Okay, I sort of sussed that out myself.  But the question remains, how
> can should_not() expect a lambda in one case, and then successfully
> operate on a String in another case, like here:
>
> @user.encrypted_password.should_not be_blank
>
>  Does the definition of should_not check the type of the receiver before
> executing?  I can't find any docs for the definition of should_not().

should and should_not are both added to every object, and pass self
(the receiver) to the matches?() method on the matcher passed to
should[_not]. e.g.

  obj.should matcher # => matcher.matches?(obj)

It is the matcher that cares what the object is, not the should[_not]
method. And the matchers do not, generally, do type checking on the
object - they just assume that you're doing the right thing, and let
Ruby handle errors if you do the wrong thing (e.g. undefined method
'call').

HTH,
David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] Re: spork error: Gem::LoadError

2011-07-18 Thread David Chelimsky
On Jul 18, 2011, at 1:27 AM, 7stud -- wrote:

> Conrad Taylor wrote in post #1011293:
>> On Sat, Jul 16, 2011 at 4:34 AM, 7stud --  wrote:
>> 
>>> versions back to the old versions, but now I get that spork error.  Is
>>> there a way to 'unactivate' spork 0.9.0 and 'activate' spork 0.8.4?
>>> 
>>> 
>> Hi, if you're installing gems using bundler, the recommended way to run
>> their associated executables is by doing the following:
>> 
>> bundle exec 
>> 
> 
> Thanks.  I read about that at the Bundler website, and now I am 
> executing all excutables with bundle exec.

FYI, if you type "bundle install --binstubs", Bundler will put wrapper commands 
in a bin directory at the root of your project. The name/location is 
customizable, but ./bin is the default. So now you can type 
"bin/", assuming the gem that installs the executable is in 
your Gemfile.

Now, if you put ./bin at the front of your path (e.g. export PATH=./bin:$PATH), 
you can just type  and it's the same as if you typed "bundle 
exec ".

Cheers,
David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] do tests save anything in the test db?

2011-07-17 Thread David Chelimsky
On Sun, Jul 17, 2011 at 7:12 AM, 7stud --  wrote:
> I have some validation tests that create!() Users, but after running the
> tests I don't see anything in my test db.  What is supposed to happen?

Yes. By default, the Rails test framework is configured to run each
test method in a transaction which gets rolled back at the end of that
test method. That way each test method is isolated from data that
might otherwise be left lying around.

HTH,
David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: Re(2): [Rails] Rails 3.1 & RSpec: Puzzled by template rendering failures

2011-07-16 Thread David Chelimsky
On Jul 10, 2011, at 4:47 PM, Leigh Daniels wrote:

> Thanks, Conrad.
> 
> I'm all green now!
> 
> **Leigh
> 
> On Sun, Jul 10, 2011, Conrad Taylor  wrote:
> 
>> Leigh, you're controller spec appear to be missing a call to the following:
>> 
>> render_views

Leigh, Conrad,

Without render_views, an empty stub template is rendered, so unless you're 
adding specs for content in the template, you shouldn't need render_views for 
the generated specs to pass as/is.

The following script results in passing specs for me (ruby 1.9.2 and 1.8.7 with 
clean gemsets in rvm, Mac OS X):

gem install rails -v 3.1.0.rc4
rails new example
cd example
echo 'gem "rspec-rails", "~> 2.6.0", :group => [:development, :test]' >> Gemfile
bundle install
rails generate rspec:install
rails generate scaffold jobs
rake db:migrate
rake db:test:prepare
rspec spec/controllers

What environment are you working in?

Cheers,
David



-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



Re: [Rails] RoutingError with RSpec Controller test on Scoped Route

2011-07-16 Thread David Chelimsky
On Jul 14, 2011, at 5:00 PM, Otis Harrison wrote:

> So I have a route that looks like this:
> 
> 
> scope "4" do
>  scope "public" do
>scope ":apikey" do
>  resources :shops
>end
>  end
> end
> 
> 
> And a bunch of controller specs, an example of which looks like this:
> 
> 
> describe ShopsController do
> 
>  describe "when responding to a GET" do
> 
>context "#new" do
>  it "should create a new instance of the shop class" do
>get :new
>@shop.should_not_be_nil
>  end
>end
> 
>  end
> 
> end
> 
> In rake routes, as well as via a web browser, this controller/action
> works fine. However, RSpec throws:
> 
> 1) ShopsController when responding to a GET#new should create a new
> instance of the shop class
> Failure/Error: get :new
> ActionController::RoutingError:
>   No route matches {:controller=>"shops", :action=>"new"}
> # ./spec/controllers/shops_controller_spec.rb:9:in `block (4 levels)
> in '
> 
> When I remove the scope statements from the route, the tests work
> fine. Is there a way to "inform" RSpec of the route scopes?

The route requires an api key, so that needs to be included in the args passed 
to 'get':

get :new, :apikey => "ignore"

As for @shop.should_not be_nil, that's probably going to fail as well once you 
get past the route issue. To specify that a new instance gets created, you'll 
need to either interact with the database, e.g.

expect do
  get :new, :apikey => "ignore"
end.to change(Shop, :count).by(1)

... or mock the message to create the model:

Shop.should_receive(:create)
get :new, :apikey => "ignore"

HTH,
David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Testing RSpec views: the index action; is my methodology flawed?

2011-06-30 Thread David Chelimsky


On Jun 30, 2:01 pm, David Zhang  wrote:
> This is my organizations_controller_spec.rb:
>
> require 'spec_helper'
>
> describe Superadmin::OrganizationsController do
>   describe "GET index" do
>     it "shows a list of all organizations" do
>       #pending "don't know why this doesn't work"
>       Organization.should_receive(:all)


You've got to actually invoke the action here:

get :index

HTH,
David

>     end
>   end
>
> end
>
> 
>
> This is my controllers/superadmin/organizations_controller.rb:
>
> class Superadmin::OrganizationsController < ApplicationController
>   def index
>     @organizations = Organization.all
>   end
> end
>
> Oddly, this doesn't pass:
>
> 1) Superadmin::OrganizationsController GET index shows a list of all
> organizations
>      Failure/Error: Organization.should_receive(:all)
>        ( updated_at: datetime) (class)>).all(any args)
>            expected: 1 time
>            received: 0 times
>
> Is my methodology incorrect?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RSpec with Rails 3.1rc4: spec test won't recognize <%= %> (should be simple)

2011-06-29 Thread David Chelimsky
On Jun 29, 1:46 pm, David Zhang  wrote:
> ...That's odd.  I just read The RSpec Book, and it explains how double isn't
> sufficient when you're testing something related to form_for.  The book, in
> its example, says to use mock_model("Message").as_new_record...
> and anyway in my case neither method is working.  If I use mock_model, I
> get
>
> Failure/Error: assign(:user_session,
> mock_model("UserSession").as_new_record)
>      ArgumentError:
>        The mock_model method can only accept as its first argument:
>          * A String representing a Class that does not exist
>          * A String representing a Class that extends ActiveModel::Naming
>          * A Class that extends ActiveModel::Naming
>
>        It received UserSession
>
> ...and if I use double, I get the error the book says I'd get: "undefined
> method `model_name' for RSpec::Mocks::Mock:Class"
>
> :/ so I wonder what the best way to test form_for is now with rspec... btw
> I'm using Capybara.

Didn't realize you needed it for form_for. You'll need to either use
the real object, or stub out all the necessary methods yourself (or
submit a patch to Authlogic to get it to conform to ActiveModel's
API).

Cheers,
David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RSpec with Rails 3.1rc4: spec test won't recognize <%= %> (should be simple)

2011-06-29 Thread David Chelimsky


On Jun 29, 12:16 pm, David Zhang  wrote:
> Thank you very much!  So I guess it was a simple issue.
>
> But what would I do for the form_for @user_session?  I tried...
>
>     before(:each) do
>       assign(:user_session, mock_model("UserSession").as_new_record)
>     end
>
> But that returns the error:
>
> Failure/Error: assign(:user_session,
> mock_model("UserSession").as_new_record)
>      ArgumentError:
>        The mock_model method can only accept as its first argument:
>          * A String representing a Class that does not exist
>          * A String representing a Class that extends ActiveModel::Naming
>          * A Class that extends ActiveModel::Naming
>
>        It received UserSession
>
> Is this because I'm using Authlogic and the UserSession model
> extends Authlogic::Session::Base?  How would I work around this?

Don't use mock_model :) You can use a standard test double:

  assign(:user_session, double("UserSession"))

or a real UserSession object if it's not complicated to set up.

HTH,
David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RSpec with Rails 3.1rc4: spec test won't recognize <%= %> (should be simple)

2011-06-29 Thread David Chelimsky
On Jun 29, 11:07 am, David Zhang  wrote:
> In my user_sessions_controller:
>
> class UserSessionsController < ApplicationController
>   before_filter :require_no_user, :only => [:create, :new]
>   before_filter :require_user, :only => :destroy
>
>   def new
>     @user_session = UserSession.new
>     @message = "Hello."
>   end
>
>   def create
>     @user_session = UserSession.new(params[:user_session])
>     if @user_session.save
>       flash[:notice] = "Login successful!"
>       redirect_back_or_default admin_path
>     else
>       render :action => :new
>     end
>   end
>
>   def destroy
>     current_user_session.destroy
>     flash[:notice] = "Logout successful!"
>     redirect_back_or_default new_user_session_url
>   end
> end
>
> 
> In views/user_sessions/new.html.erb:
>
> 
> Admin Login
> <%= @message %>
>
> 
> In spec/views/user_sessions/new.html.erb_spec.rb:
>
> require 'spec_helper'
>
> describe "user_sessions/new.html.erb" do
>
>   context "displays the admin login form" do
>     it "shows the title" do
>       render
>       rendered.should have_content("Admin Login") # this is fine
>       rendered.should have_content("Hello.") # I added this just to test
> something simple, but it didn't work
>     end
>
>     it "shows the form"
>
>     it "shows the button"
>   end
>
> end
> 
> If I do "rails server" and check out the page in the browser, there is the
> "Hello." just as I expect.  But the spec test fails to get it.. it /should/
> pass:
> 1) user_sessions/new.html.erb displays the admin login form shows the title
>      Failure/Error: rendered.should have_content("Hello.")
>        expected there to be content "Hello." in "Admin Login\n\n\n\n"
>      # ./spec/views/user_sessions/new.html.erb_spec.rb:9:in `block (3
> levels) in '
>
> So why might the <%= %> not be properly showing the @message?
>
> I actually originally had the form code in the view:
> <%= form_for @user_session, :url => user_session_path do |f| %>
> <%= f.label :login %>
> <%= f.text_field :login, :id=>"admin_login" %>
>
> <%= f.label :password %>
> <%= f.password_field :password, :id=>"admin_password" %>
>
> <%= f.submit "Login", :id=>"admin_login_button" %>
> <% end %>
>
> .. but testing for this yielded
> Failure/Error: render
>      ActionView::Template::Error:
>        undefined method `model_name' for NilClass:Class
>
> So the @user_session variable wasn't being recognized by the spec test.
>  Similar problem?
>
> Assistance is appreciated.

This is not really an rspec issue, but a rails view testing issue.
When you render a view directly in a test, it does not use the
associated controller, and it is up to you to set up the instance
variables needed by the view. In this case:

it "shows the title" do
  assign(:message, "Hello.")
  render
  rendered.should have_content("Admin Login")
  rendered.should have_content("Hello.")
end

HTH,
David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RSpec / Capybara ? (from The RSpec Book): Why might "should have_selector" silently pass when nested?

2011-06-13 Thread David Chelimsky
On Jun 13, 1:22 pm, daze  wrote:
> Thank you.  But then what should be the work around for this with
> Capybara?  I was leaning toward using capybara...


rendered.should have_selector("form input[@type='submit']")

You can also use assert_select which ships with Rails and supports
nesting if you prefer.

> Actually, do you recommend webrat over capybara?  I just want one with
> good documentation and stick with one for the sake of getting used to
> the syntax.

That's tricky. Capybara is under regular development and has a growing
user base. Webrat has been around longer and already supports the
matchers you're looking for, but hasn't had a commit in 5 months. I'm
using Capy on new projects if you want to take that as a
recommendation.

> Now... One last thing.  I notice that when I try webrat, has_content?
> no longer works.
> I'm guessing has_content? is specific to Capybara... is "should
> contain" the equivalent in webrat?

Yep.

>
> Thanks again.
>
> On Jun 13, 11:02 am, David Chelimsky  wrote:
>
>
>
> > On Jun 13, 8:36 am, daze  wrote:
>
> > > I'm going through The RSpec Book, and (specifically around page 333) I
> > > encountered a problem.  Basically, whenever I use "should
> > > have_selector" in a nested form, it silently passes when it SHOULD
> > > fail.
>
> > > I've been copying the code exactly as from the book.  Now, there is
> > > one major difference - I'm using Capybara while the book is using
> > > Webrat.  Why?  I've had bigger problems with Webrat.  In fact, when I
> > > switch to Webrat by putting it in the Gemfile, I get this unidentified
> > > method error in which has_selector isn't recognized (which is doubly
> > > odd because this happens where I call have_selector...)
>
> > > Anyway, here's the code:
>
> > > ---new.html.erb_spec.rb---
>
> > > require 'spec_helper'
>
> > > describe "messages/new.html.erb" do
>
> > >   let(:message) do
> > >     mock_model("Message").as_new_record.as_null_object
> > >   end
>
> > >   before do
> > >     assign :message, message
> > >   end
>
> > >   it "renders a form to create a message" do
> > >     render
> > >     rendered.should have_selector("form",
> > >       :method => "post",
> > >       :action => messages_path
> > >     ) do |form|
> > >       form.should have_selector("input", :type => "submit")  # this
> > > should be failing right now!!!
> > >     end
> > >   end
>
> > >   # this should be failing right now!!!
> > >   it "renders a text field for the message title" do
> > >     message.stub(:title => "the title")
> > >     render
> > >     rendered.should have_selector("form") do |form|
> > >       form.should have_selector("input",
> > >         :type => "submit",
> > >         :name => "message[title]",
> > >         :value => "the title"
> > >       )
> > >     end
> > >   end
>
> > >   # this should be failing right now!!!
> > >   it "renders a text area for the message text" do
> > >     message.stub(:text => "the message")
> > >     render
> > >     rendered.should have_selector("form") do |form|
> > >       form.should have_selector("textarea",
> > >         :name => "message[text]",
> > >         :content => "the message"
> > >       )
> > >     end
> > >   end
> > > end
>
> > > -new.html.erb--
>
> > > <%= form_for @message do |f| %>
>
> > > # nothing is in here, so those nested "should have_selector"
> > > statements should fail
>
> > > <% end %>
>
> > > Thanks in advance!
>
> > The examples in the book use webrat, which has a has_selector matcher
> > that supports nesting. The capybara have_selector matcher does not
> > support nesting (yet). You don't get any feedback because Ruby lets
> > you pass a block to any method, and leaves it to the method to handle
> > it or ignore it. In this case it's being ignored.
>
> > HTH,
> > David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: RSpec / Capybara ? (from The RSpec Book): Why might "should have_selector" silently pass when nested?

2011-06-13 Thread David Chelimsky
On Jun 13, 8:36 am, daze  wrote:
> I'm going through The RSpec Book, and (specifically around page 333) I
> encountered a problem.  Basically, whenever I use "should
> have_selector" in a nested form, it silently passes when it SHOULD
> fail.
>
> I've been copying the code exactly as from the book.  Now, there is
> one major difference - I'm using Capybara while the book is using
> Webrat.  Why?  I've had bigger problems with Webrat.  In fact, when I
> switch to Webrat by putting it in the Gemfile, I get this unidentified
> method error in which has_selector isn't recognized (which is doubly
> odd because this happens where I call have_selector...)
>
> Anyway, here's the code:
>
> ---new.html.erb_spec.rb---
>
> require 'spec_helper'
>
> describe "messages/new.html.erb" do
>
>   let(:message) do
>     mock_model("Message").as_new_record.as_null_object
>   end
>
>   before do
>     assign :message, message
>   end
>
>   it "renders a form to create a message" do
>     render
>     rendered.should have_selector("form",
>       :method => "post",
>       :action => messages_path
>     ) do |form|
>       form.should have_selector("input", :type => "submit")  # this
> should be failing right now!!!
>     end
>   end
>
>   # this should be failing right now!!!
>   it "renders a text field for the message title" do
>     message.stub(:title => "the title")
>     render
>     rendered.should have_selector("form") do |form|
>       form.should have_selector("input",
>         :type => "submit",
>         :name => "message[title]",
>         :value => "the title"
>       )
>     end
>   end
>
>   # this should be failing right now!!!
>   it "renders a text area for the message text" do
>     message.stub(:text => "the message")
>     render
>     rendered.should have_selector("form") do |form|
>       form.should have_selector("textarea",
>         :name => "message[text]",
>         :content => "the message"
>       )
>     end
>   end
> end
>
> -new.html.erb--
>
> <%= form_for @message do |f| %>
>
> # nothing is in here, so those nested "should have_selector"
> statements should fail
>
> <% end %>
>
> Thanks in advance!

The examples in the book use webrat, which has a has_selector matcher
that supports nesting. The capybara have_selector matcher does not
support nesting (yet). You don't get any feedback because Ruby lets
you pass a block to any method, and leaves it to the method to handle
it or ignore it. In this case it's being ignored.

HTH,
David

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: how can I investigate when a rspec test fails?

2011-05-28 Thread David Chelimsky


On May 28, 12:59 pm, Mauro  wrote:
> For example:
>
> it "re-renders the 'new' template" do
>       # Trigger the behavior that occurs when invalid params are submitted
>       Sector.any_instance.stub(:save).and_return(false)
>       post :create, :sector => {}
>       response.should render_template("new")
> end
>
> I have the new template under app/views/sectors but the test says:
>
> SectorsController POST create with invalid params re-renders the 'new' 
> template
>      Failure/Error: response.should render_template("new")
>      expecting <"new"> but rendering with <"">

Please post the controller action so we can see what's missing.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-rails-2.6.1 is released!

2011-05-25 Thread David Chelimsky
rspec-rails-2.6.1 is released!

This is a bug fix release that is compatible with the rails-3.0.0 to 3.0.7, 
3.0.8.rc1, and 3.1.0.rc1 (it is mostly, but not fully compatible with but not 
rails-3.1.0.beta1).

### rspec-rails-2.6.1 / 2011-05-25

full changelog: http://github.com/rspec/rspec-rails/compare/v2.6.0...v2.6.1

* Bug fixes
  * fix controller specs with anonymous controllers with around filters
  * exclude spec directory from rcov metrics (Rodrigo Navarro)
  * guard against calling prerequisites on nil default rake task (Jack Dempsey)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-core-2.6.1 is released!

2011-05-19 Thread David Chelimsky
rspec-core-2.6.1 is released!

This is a bug fix release, restoring integration with with rcov.

full changelog: http://github.com/rspec/rspec-core/compare/v2.6.0...v2.6.1

* Bug fixes
  * Don't extend nil when filters are nil
  * `require 'rspec/autorun'` when running rcov.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.6.0.rc6 is released!

2011-05-06 Thread David Chelimsky
We're doing one more release candidate to update rspec-rails to work with 
rails-3.1.0.beta1. This will hopefully be the last release candidate, with a 
final release coming in just a few days.

### rspec-rails-2.6.0.rc6

full changelog: 
http://github.com/rspec/rspec-rails/compare/v2.6.0.rc4...v2.6.0.rc6

* Bug fixes
  * Fix load order issue w/ Capybara (oleg dashevskii)
  * Relax the dependencies on rails gems to >= 3.0 (Joel Moss)
  * Fix monkey patches that broke due to internal changes in rails-3.1.0.beta1

### rspec-core-2.6.0.rc6

full changelog: 
http://github.com/rspec/rspec-core/compare/v2.6.0.rc4...v2.6.0.rc6

* Enhancements
  * Restore --pattern/-P command line option from rspec-1
  * Support false as well as true in config.full_backtrace= (Andreas Tolf 
Tolfsen)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.6.0.rc2 is released!

2011-04-17 Thread David Chelimsky
We're releasing rspec-2.6.0.rc2 as a release candidate as there are some 
internal changes that we'd like to see put through their paces before doing a 
final release. Note that the changes I speak of are internal. There are no new 
deprecations in this release, nor any backward-incompatible changes.

There are, however, some new features that we're really excited about. Please 
do check it out and please do report any issues to the appropriate github issue 
tracker:

* [rspec-core](http://github.com/rspec/rspec-core/issues)
* [rspec-expectations](http://github.com/rspec/rspec-expectations/issues)
* [rspec-mocks](http://github.com/rspec/rspec-mocks/issues)
* [rspec-rails](http://github.com/rspec/rspec-rails/issues)

### rspec-core-2.6.0.rc2

[full changelog](http://github.com/rspec/rspec-core/compare/v2.5.1...v2.6.1.rc2)

* Enhancements
  * `shared_context` (Damian Nurzynski)
  * extend groups matching specific metadata with:
  * method definitions
  * subject declarations
  * let/let! declarations
  * etc (anything you can do in a group)
  * `its([:key])` works for any subject with #[]. (Peter Jaros)
  * `treat_symbols_as_metadata_keys_with_true_values` (Myron Marston)
  * Print a deprecation warning when you configure RSpec after defining
an example.  All configuration should happen before any examples are
defined. (Myron Marston)
  * Pass the exit status of a DRb run to the invoking process. This causes
specs run via DRb to not just return true or false. (Ilkka Laukkanen)
  * Refactoring of ConfigurationOptions#parse_options (Rodrigo Rosenfeld Rosas)
  * Report excluded filters in runner output (tip from andyl)

* Bug fixes
  * Don't stumble over an exception without a message (Hans Hasselberg)
  * Remove non-ascii characters from comments that were choking rcov (Geoffrey
Byers)
  * Fixed backtrace so it doesn't include lines from before the autorun at_exit
hook (Myron Marston)
  * Include RSpec::Matchers when first example group is defined, rather
than just before running the examples.  This works around an obscure
bug in ruby 1.9 that can cause infinite recursion. (Myron Marston)
  * Don't send example_group_[started|finished] to formatters for empty groups.
  * Get specs passing on jruby (Sidu Ponnappa)
  * Fix bug where mixing nested groups and outer-level examples gave
unpredictable :line_number behavior (Artur Małecki)
  * Regexp.escape the argument to --example (tip from Elliot Winkler)
  * Correctly pass/fail pending block with message expectations

### rspec-expectations-2.6.0.rc2

[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.5.0...v2.6.1.rc2)

* Enhancments
  * `change` matcher accepts Regexps (Robert Davis)
  * better descriptions for have_xxx matchers (Magnus Bergmark)

* Bug fixes
  * Removed non-ascii characters that were choking rcov (Geoffrey Byers)
  * change matcher dups arrays and hashes so their before/after states can be
compared correctly.
  * Fix the order of inclusion of RSpec::Matchers in
Test::Unit::TestCase and MiniTest::Unit::TestCase to prevent a
SystemStackError (Myron Marston)


### rspec-mocks-2.6.0.rc2

[full 
changelog](http://github.com/rspec/rspec-mocks/compare/v2.5.0...v2.6.1.rc2)

* Enhancements
  * Add support for any_instance.stub and any_instance.should_receive (Sidu
Ponnappa and Andy Lindeman)

* Bug fixes
  * fix bug in which multiple chains with shared messages ending in hashes
failed to return the correct value

### rspec-rails-2.6.0.rc2

[full 
changelog](http://github.com/rspec/rspec-rails/compare/v2.5.0...v2.6.1.rc2)

* Enhancments
  * rails 3 shortcuts for routing specs (Joe Fiorini)
  * support nested resources in generators (Tim McEwan)
  * require 'rspec/rails/mocks' to use `mock_model` without requiring the whole
rails framework

* Bug fixes
  * fix typo in "rake spec:statsetup" (Curtis Schofield)
  * expose named routes in anonymous controller specs (Andy Lindeman)
  * error when generating namespaced scaffold resources (Andy Lindeman)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-core-2.5.1 is released!

2011-02-06 Thread David Chelimsky
rspec-core-2.5.1 is released!

[full changelog](http://github.com/rspec/rspec-core/compare/v2.5.0...v2.5.1)

 This release breaks compatibility with rspec/autotest/bundler integration, 
but does so in order to greatly simplify it.

With the release of rspec-core-2.5.1, if you want the generated autotest 
command to include `bundle exec`, require Autotest's bundler plugin in a 
`.autotest` file in the project's root directory or in your home directory:

require "autotest/bundler"

Now you can just type 'autotest' on the commmand line and it will work as you 
expect.

If you don't want 'bundle exec', there is nothing you have to do.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.5.0 is released!

2011-02-06 Thread David Chelimsky
RSpec-2.5.0 is released!

This is a minor upgrade, and is fully backward compatible with rspec-2.4. It 
includes several bug fixes, enhancements, and one deprecation. See the 
changelog below for details.

We had a little glitch publishing the docs to 
[http://relishapp.com/rspec](http://relishapp.com/rspec), so the 2.5 docs won't 
be up for another day or two, so I'll detail the noticable differences here 
(and on http://blog.davidchelimsky.net/2011/02/06/rspec-250-is-released/).

## Autotest/Bundler integration

### --skip-bundler

RSpec's Autotest integration assumes that you want `bundle exec` in the shell 
command generated by Autotest if you have a `Gemfile`. This works fine for some 
situations, but not all, so we added an opt-out for rspec-2.5:

autotest -- --skip-bundler

Autotest ignores everything after the initial `--`, so RSpec's Autotest 
extension handles the `--skip-bundler` option.

### Autotest's bundler plugin

Autotest ships with a plugin for bundler. Just add the following to a 
`.autotest` file in the project's root directory, or your home directory:

require 'autotest/bundler'

This prefixes the generated shell command with 'bundle exec'.

### Implicit detection of Gemfile is deprecated

Given that Autotest has its own way of dealing with Bundler (see above), we 
deprecated the implicit assumption that `Gemfile` means "use bundler". You'll 
see a deprecation notice if you are relying on that, but it _still works_. It's 
just a deprecation warning. To silence the warning, either use the 
`--skip-bundler` option or Autotest's bundler plugin, described above.

## HTML Formatter

The HTML formatter now has a set of checkboxes in the header that allow you to 
filter what you're looking at:

https://img.skitch.com/20110205-xup5ktgdua75rfs8fwtr1yf1b7.jpg";>

## to not, or not to not

Are you the sort of person for whom "expect this block of code _to not_ raise 
an error" is like nails on chalkboard? If so, relief has arrived. You may now 
type either of the following, and RSpec will happily service you:

expect { ... }.to_not raise_error
expect { ... }.not_to raise_error

## Changelog

### rspec-core-2.5.0

[full changelog](http://github.com/rspec/rspec-core/compare/v2.4.0...v2.5.0)

* Enhancements
  * Autotest::Rspec2 parses command line args passed to autotest after '--'
  * --skip-bundler option for autotest command
  * Autotest regexp fixes (Jon Rowe)
  * Add filters to html and textmate formatters (Daniel Quimper)
  * Explicit passing of block (need for JRuby 1.6) (John Firebaugh)

* Bug fixes
  * fix dom IDs in HTML formatter (Brian Faherty)
  * fix bug with --drb + formatters when not running in drb
  * include --tag options in drb args (monocle)
  * fix regression so now SPEC_OPTS take precedence over CLI options again
(Roman Chernyatchik)
  * only call its(:attribute) once (failing example from Brian Dunn)
  * fix bizarre bug where rspec would hang after `String.alias :to_int :to_i`
(Damian Nurzynski)

* Deprecations
  * implicit inclusion of 'bundle exec' when Gemfile present (use autotest's
bundler plugin instead)

### rspec-expectations-2.5.0

[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.4.0...v2.5.0)

* Enhancements
  * `should exist` works with `exist?` or `exists?` (Myron Marston)
  * `expect { ... }.not_to do_something` (in addition to `to_not`)

* Documentation
  * improved docs for `raise_error` matcher (James Almond)

### rspec-mocks-2.5.0

[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.4.0...v2.5.0)

* Bug fixes
  * message expectation counts now work in combination with a stub (Damian
Nurzynski)
  * fix failure message when message received with incorrect args (Josep M.
Bach)

### rspec-rails-2.5.0

[full changelog](http://github.com/rspec/rspec-rails/compare/v2.4.1...v2.5.0)

* Enhancements
  * use `index_helper` instead of `table_name` when generating specs (Reza
Primardiansyah)
 
* Bug fixes
  * fixed bug in which `render_views` in a nested group set the value in its
parent group.
  * only include MailerExampleGroup when it is defiend (Steve Sloan)
  * `mock_model.as_null_object.attribute.blank?` returns `false` (Randy Schmidt)
  * fix typo in request specs (Paco Guzman)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-rails-2.4.1 is released!

2011-01-02 Thread David Chelimsky
This is a bug fix release recommended for all users who have upgraded to 
rspec-rails-2.4.

### rspec-rails-2.4.1 / 2011-01-03

[full changelog](http://github.com/rspec/rspec-rails/compare/v2.4.0...v2.4.1)

* Bug fixes
  * fixed bug caused by including some Rails modules before RSpec's
RailsExampleGroup

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-rails-2.4.0 is released!

2011-01-02 Thread David Chelimsky
### rspec-rails-2.4.0 / 2011-01-02

[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.1...2.4.0)

* Enhancements
  * include ApplicationHelper in helper object in helper specs
  * include request spec extensions in files in spec/integration
  * include controller spec extensions in groups that use :type => :controller
* same for :model, :view, :helper, :mailer, :request, :routing

* Bug fixes
  * restore global config.render_views so you only need to say it once
  * support overriding render_views in nested groups
  * matchers that delegate to Rails' assertions capture
ActiveSupport::TestCase::Assertion (so they work properly now with
should_not in Ruby 1.8.7 and 1.9.1)

* Deprecations
  * `include_self_when_dir_matches`

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.4.0 is released!

2011-01-02 Thread David Chelimsky
Changes to rspec-core listed below. There are no functional changes to 
rspec-mocks or rspec-expectations for this release.

Happy New Year!

Cheers,
David

### rspec-core-2.4.0 / 2011-01-02

[full changelog](http://github.com/rspec/rspec-core/compare/v2.3.1...v2.4.0)

* Enhancements
  * start the debugger on -d so the stack trace is visible when it stops
(Clifford Heath)
  * apply hook filtering to examples as well as groups (Myron Marston)
  * support multiple formatters, each with their own output
  * show exception classes in failure messages unless they come from RSpec
matchers or message expectations
  * before(:all) { pending } sets all examples to pending

* Bug fixes
  * fix bug due to change in behavior of reject in Ruby 1.9.3-dev (Shota 
Fukumori)
  * fix bug when running in jruby: be explicit about passing block to super
(John Firebaugh)
  * rake task doesn't choke on paths with quotes (Janmejay Singh)
  * restore --options option from rspec-1
  * require 'ostruct' to fix bug with its([key]) (Kim Burgestrand)
  * --configure option generates .rspec file instead of autotest/discover.rb



-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-core-2.3.1 is released

2010-12-16 Thread David Chelimsky
### rspec-core-2.3.1 / 2010-12-16

full changelog: http://github.com/rspec/rspec-core/compare/v2.3.0...v2.3.1

* Bug fixes
  * send debugger warning message to $stdout if RSpec.configuration.error_stream
has not been defined yet. 
  * HTML Formatter _finally_ properly displays nested groups (Jarmo Pertman)
  * eliminate some warnings when running RSpec's own suite (Jarmo Pertman)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-rails-2.3.1 is released!

2010-12-16 Thread David Chelimsky
### rspec-rails-2.3.1 / 2010-12-16

[full changelog](http://github.com/rspec/rspec-rails/compare/v2.3.0...v2.3.1)

* Bug fixes
  * respond_to? correctly handles 2 args
  * scaffold generator no longer fails on autotest directory

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.3.0 is released

2010-12-12 Thread David Chelimsky
rspec-2.3.0 is released (including rspec, rspec-core, rspec-mocks, 
rspec-expecations and rspec-rails).

### rspec-core-2.3.0 / 2010-12-12

[full changelog](http://github.com/rspec/rspec-core/compare/v2.2.1...v2.3.0)

* Enhancements
  * tell autotest to use "rspec2" if it sees a .rspec file in the project's
root directory
* replaces the need for ./autotest/discover.rb, which will not work with
  all versions of ZenTest and/or autotest
  * config.expect_with
* :rspec  # => rspec/expectations
* :stdlib # => test/unit/assertions
* :rspec, :stdlib # => both

* Bug fixes
  * fix dev Gemfile to work on non-mac-os machines (Lake Denman)
  * ensure explicit subject is only eval'd once (Laszlo Bacsi)

### rspec-expectations-2.3.0 / 2010-12-12

[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.2.1...v2.3.0)

* Enhancements
  * diff strings when include matcher fails (Mike Sassak)

### rspec-mocks-2.3.0 / 2010-12-12

[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.2.1...v2.3.0)

* Bug fixes 
  * Fix our Marshal extension so that it does not interfere with objects that
have their own @mock_proxy instance variable. (Myron Marston)

### rspec-rails-2.3.0 / 2010-12-12

[full changelog](http://github.com/rspec/rspec-rails/compare/v2.2.1...v2.3.0)

* Changes
  * Generator no longer generates autotest/autodiscover.rb, as it is no longer
needed (as of rspec-core-2.3.0)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Rails 3 rspec 2 rendering XML repsonse.should contain(.to_xml)

2010-11-29 Thread David Chelimsky


On Nov 29, 2:58 pm, GregD  wrote:
> Hi all,
>
> Is there an issue with Rails 3 or rspec 2 that the
> repond_with({"success" => "test") where the response is not an xml
> text?
>
> I have almost converted an old Rails 2 app to Rails 3 and having an
> issue with the rspec tests and the response content for xml.  It works
> for json, but not xml.
>
> Say I have something like this.
>
> SimpleController < ActionController::Base
>
>   respond_to :html, :xml, :json
>
>   def test_action
>     �...@foo = { "success" => "test" }
>      respond_with(@foo) do |format|
>        format.html { render :text => "success"}
>     end
>   end
> end
>
> When I tested the xml rendering, I check the response contains
> (have_text in rails 2) for the content.  In the past (rails 2 and
> rspec 1.x), I would test this as:
> response.should have_text("
> \n\n  test\n\n")
>
> I converted the 'have_text' to 'contain' to read:
> response.should contain("
> \n\n  test\n\n")

The contain matcher comes from either webrat or capybara, and is
designed to specify content that is visible in a browser in an HTML
page (i.e. not tags).

I'd go with have_xpath instead, which is supported by both webrat and
capybara, though with slightly different APIs for each (check their
docs).

HTH,
David

>
> This spec fails with on xml and not json:
>
>      Failure/Error: response.should contain(success_text)
>      expected the following element's content to include " version="1.0" encoding="UTF-8"?>
>      
>        xml
>      
>      ":
>      test
>
> It looks like, the response is only "test" which is the value of the
> hash.
>
> On json the response is as expected:  {"success":"test"}.
>
> Sorry for the lame example, but I really did not want to go into big
> long explanation of the "real" test code.  Basically, I test the
> response and it should contain valid xml or json based on the format.
> I even tried response.body and it fails.  Is this a rspec issue?  I
> did a pp of the response and the body does look like the expected
> result.
>
> Has anyone come across this?
>
> Thanks,
>
> GregD

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-core-2.2.1 is released!

2010-11-29 Thread David Chelimsky
### rspec-core-2.2.1 / 2010-11-28

[full changelog](http://github.com/rspec/rspec-core/compare/v2.2.0...master)

* Bug fixes
  * alias_method instead of override Kernel#method_missing (John Wilger)
  * changed --autotest to --tty in generated command (MIKAMI Yoshiyuki) 
  * revert change to debugger (had introduced conflict with Rails)
* also restored --debugger/-debug option

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.2 is released!

2010-11-28 Thread David Chelimsky
### rspec-core-2.2.0

[full changelog](http://github.com/rspec/rspec-core/compare/v2.1.0...master)

* Deprecations/changes
  * --debug/-d on command line is deprecated and now has no effect
  * win32console is now ignored; Windows users must use ANSICON for color 
support
(Bosko Ivanisevic)

* Enhancements
  * Raise exception with helpful message when rspec-1 is loaded alongside
rspec-2 (Justin Ko)
  * debugger statements _just work_ as long as ruby-debug is installed
* otherwise you get warned, but not fired
  * Expose example.metadata in around hooks
  * Performance improvments (see 
[Upgrade.markdown](https://github.com/rspec/rspec-core/blob/master/Upgrade.markdown))

* Bug fixes
  * Make sure --fail-fast makes it across drb
  * Pass -Ilib:spec to rcov

### rspec-mocks-2.2.0

[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.1.0...v2.2.0)

* Enhancements
  * Added "rspec/mocks/standalone" for exploring the rspec-mocks in irb.

* Bug fix
  * Eliminate warning on splat args without parens (Gioele Barabucci)
  * Fix bug where obj.should_receive(:foo).with(stub.as_null_object) would  


pass with a false positive.

### rspec-rails-2.2.0

[full changelog](http://github.com/rspec/rspec-rails/compare/v2.1.0...master)

* Enhancements
  * Added stub_template in view specs

* Bug fixes
  * Properly include helpers in views (Jonathan del Strother)
  * Fix bug in which method missing led to a stack overflow
  * Fix stack overflow in request specs with open_session
  * Fix stack overflow in any spec when method_missing was invoked
  * Add gem dependency on rails ~> 3.0.0 (ensures bundler won't install
rspec-rails-2 with rails-2 apps).

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.1 is released!

2010-11-07 Thread David Chelimsky
### rspec-core-2.1.0 / 2010-11-07

[Cucumber features](http://relishapp.com/rspec/rspec-core/v/2-1)
[RDoc](http://rdoc.info/gems/rspec-core/2.1.0/frames) # will be generated by 
2010-11-08
[full changelog](http://github.com/rspec/rspec-core/compare/v2.0.1...v2.1.0)

* Enhancments
  * Add skip_bundler option to rake task to tell rake task to ignore the
presence of a Gemfile (jfelchner)
  * Add gemfile option to rake task to tell rake task what Gemfile to look
for (defaults to 'Gemfile')
  * Allow passing caller trace into Metadata to support extensions (Glenn
Vanderburg)
  * Add deprecation warning for Spec::Runner.configure to aid upgrade from
RSpec-1
  * Add deprecated Spec::Rake::SpecTask to aid upgrade from RSpec-1
  * Add 'autospec' command with helpful message to aid upgrade from RSpec-1
  * Add support for filtering with tags on CLI (Lailson Bandeira)
  * Add a helpful message about RUBYOPT when require fails in bin/rspec
(slyphon)
  * Add "-Ilib" to the default rcov options (Tianyi Cui)
  * Make the expectation framework configurable (default rspec, of course)
(Justin Ko)
  * Add 'pending' to be conditional (Myron Marston)
  * Add explicit support for :if and :unless as metadata keys for conditional 
run
of examples (Myron Marston)
  * Add --fail-fast command line option (Jeff Kreeftmeijer)

* Bug fixes
  * Eliminate stack overflow with "subject { self }"
  * Require 'rspec/core' in the Raketask (ensures it required when running rcov)

### rspec-expectations-2.1.0 / 2010-11-07

[Cucumber features](http://relishapp.com/rspec/rspec-expectations/v/2-1)
[RDoc](http://rdoc.info/gems/rspec-expectations/2.1.0/frames) # will be 
generated by 2010-11-08
[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.1...v2.1.0)

* Enhancements
  * be_within(delta).of(expected) matcher (Myron Marston)
  * Lots of new Cucumber features (Myron Marston)
  * Raise error if you try "should != expected" on Ruby-1.9 (Myron Marston)
  * Improved failure messages from throw_symbol (Myron Marston)

* Bug fixes
  * Eliminate hard dependency on RSpec::Core (Myron Marston)
  * have_matcher - use pluralize only when ActiveSupport inflections are indeed
defined (Josep M Bach)
  * throw_symbol matcher no longer swallows exceptions (Myron Marston)
  * fix matcher chaining to avoid name collisions (Myron Marston)

### rspec-mocks-2.1.0 / 2010-11-07

[Cucumber features](http://relishapp.com/rspec/rspec-mocks/v/2-1)
[RDoc](http://rdoc.info/gems/rspec-mocks/2.1.0/frames) # will be generated by 
2010-11-08
[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.1...v2.1.0)

* Bug fixes
  * Fix serialization of stubbed object (Josep M Bach)

### rspec-rails-2.1.0 / 2010-11-07

[Cucumber features](http://relishapp.com/rspec/rspec-rails/v/2-1)
[RDoc](http://rdoc.info/gems/rspec-rails/2.1.0/frames) # will be generated by 
2010-11-08
[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.1...v2.1.0)

* Enhancements
  * Move errors_on to ActiveModel to support other AM-compliant ORMs

* Bug fixes
  * Check for presence of ActiveRecord instead of checking Rails config
(gets rspec out of the way of multiple ORMs in the same app)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.0.1 is released!

2010-10-18 Thread David Chelimsky
This is primarily a bug-fix release for rspec-core:

### rspec-core-2.0.1

[full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0...v2.0.1)

* Bug fixes
  * restore color when using spork + autotest
  * Pending examples without docstrings render the correct message (Josep M. 
Bach)
  * Fixed bug where a failure in a spec file ending in anything but _spec.rb 
would
fail in a confusing way.
  * Support backtrace lines from erb templates in html formatter (Alex Crichton)

### rspec-expectations-2.0.1

[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0...v2.0.1)

* Enhancements
  * Make dependencies on other rspec gems consistent across gems

### rspec-mocks-2.0.1

[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0...v2.0.1)

* Enhancements
  * Make dependencies on other rspec gems consistent across gems

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-rails-2.0.1 is released!

2010-10-15 Thread David Chelimsky
The rails-3.0.1 release excluded a change that I had naively expected to be 
included. This upgrade is only necessary if you write view specs and are 
upgrading to rails-3.0.1. To upgrade, all you need to do is change your Gemfile 
to read:

gem "rspec-rails", "2.0.1"

And then run

bundle update rspec-rails

## Release Notes

### 2.0.1 / 2010-10-15

[full changelog](http://github.com/rspec/rspec-rails/compare/v2.0.0...v2.0.1)

* Enhancements
  * Add option to not generate request spec (--skip-request-specs)

* Bug fixes
  * Updated the mock_[model] method generated in controller specs so it adds
any stubs submitted each time it is called.
  * Fixed bug where view assigns weren't making it to the view in view specs in 
Rails-3.0.1.
(Emanuele Vicentini)

Cheers,
David



-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] RSpec-2.0.0 is released!

2010-10-10 Thread David Chelimsky
## RSpec-2.0.0 has been released!

This marks the end of a year-long effort that improves RSpec in a number of 
ways, including modularity, cleaner code, and much better integration with 
Rails-3 than was possible before (see 
http://blog.davidchelimsky.net/2010/01/25/rspec-20-in-the-works/).

### Docs, with a little bit of relish

In addition to the documentation available at all the places (see 
http://blog.davidchelimsky.net/2010/07/01/rspec-2-documentation/), we've also 
got all of the Cucumber features posted to Justin Ko's new Cucumber 
presentation app, relish.

  http://relishapp.com/rspec

We'll also have the RDoc up on http://rdoc.info in a day or so.

### Thanks!

Big thanks to 80+ contributors who submitted patches for RSpec-2.0.0, including 
[1]:

Aan, Adam Walters, Akira Matsuda, Alex Crichton, Anderson Dias, Andre Arko, 
Andreas Neuhaus, Ashley Moran, Ben Armston, Ben Rady, Brasten Sager, Brian J 
Reath, Carlhuda, Chad Humphries, Charles Lowell, Chris Redinger, Chuck Remes, 
Corey Ehmke, Corey Haines, Dan Peterson, Dave Newman, David Genord II, David S. 
Kang, Ethan Gunderson, Gonçalo Silva, Greg Sterndale, Hans de Graaff, Iain 
Hecker, Jacques Crocker, Jean-Daniel Guyot, Jeff Ramnani, Jim Breen, Johan 
Kiviniemi, Josep Mª Bach, Josh Graham, Joshua Nichols, Kabari Hendrick, 
Kristian M, Lailson B, Len Smith, Leonardo Bessa, Les Hill, Luis Lavena, Marcin 
Kulik, Markus Schirp, Matt Remsik, Matt Yoho, Matthew Todd, Michael Niessner, 
Mike Gehard, Myron Marston, Nate Jackson, Neeraj Singh, Nestor Ovroy, Nick Ang, 
Nicolas Braem, Paul Rosania, Phil Smith, Postmodern, Prasad, Rob Sanheim, Roman 
Chernyatchik, Ryan Bigg, Ryan Briones, Sam Pohlenz, Scott Taylor, Shin-ichiro 
OGAWA, Thibaud Guillaume-Gentil, Tim Connor, Tim Harper, Tom Stuart, Vít 
Ondruch, Wincent Colaiuta, aslakhellesoy, eira, garren smith, grosser, hasimo, 
justinko, rup, speedmax, wycats

Extra special thanks go to:

* Chad Humphries for contributing his Micronaut gem which is the basis for 
rspec-core-2
* Yehuda Katz, Carl Lerche, and José Valim, for their assistance with getting 
rspec-rails-2 to take advantage of new APIs in Rails-3, and for shepherding 
patches to Rails that made it far simpler for testing extensions like 
rspec-rails to hook into Rails' testing infrastructure. Their work here has 
significantly reduced the risk that Rails point-releases will break rspec-rails.
* Myron Marston for a wealth of thoughtful contributions including Cucumber 
features that we can all learn from
* Justin Ko for his direct contributions to rspec, and for relish 
(http://relishapp.com/), which makes executable documentation act more like 
documentation.

### What's next?

 rspec-rails-2 for rails-2

There are a couple of projects floating around that support rspec-2 and 
rails-2. I haven't had the chance to review any of these myself, but my hope is 
that we'll have be an official rspec-2 for rails-2 gem in the coming months.

 rspec-1 maintenance

rspec-1 will continue to get maintenance releases, but these will be 
restricted, primarily, to bug fixes. Any new features will go into rspec-2, and 
will likely not be back-ported.

[1] Contributor names were generated from the git commit logs.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Why is RSpec so slow with Rails 3?

2010-10-09 Thread David Chelimsky


On Oct 9, 9:29 pm, egervari  wrote:
> Okay, I admit and I newbie when it comes to this stuff. I'm using
> Rails 3 (latest) and I put this line in my Gemfile:
>
> group :test do
>   gem 'rspec-rails'
> end
>
> I'm guessing that's going to get the latest version of rspec-rails.

Actually that gets the latest production release of rspec-rails, which
is rspec-rails-1.3.3 (as of about 10 minutes ago).

What you want is rspec-rails-2.0.0.rc, and you want to include it in
both development and test groups:

group :development, :test do
  gem 'rspec-rails', '>= 2.0.0.rc'
end

> As for other questions, I'm running Ruby 1.9.1 on Windows 7 64-bit
> (not exactly the best OS for out-of-the-box working and stable use of
> Ruby, I know).

Yeah - I've given up trying to run ruby on windows. It's just so much
better on Linux or Mac OS. There are plenty of people here, more brave
than I, however, who can help you in that area.

> In my IDE, If I run the same could out of RSpec, it is basically
> instant. If I run RSpec, it reports that the test only took 5 seconds,
> but the entire execution was 20 seconds. If I had more dummy tests in
> the same Spec file, it is basically instant. So my guess is that 15
> seconds is used by Rails and 5 seconds is used by RSpec? My guess is
> that the actual code in the tests is a few milliseconds.

5 seconds is painfully long for 1 example. Once you've paid the
startup debt (which comes from a combination of rspec, rails,
bundler), it should be < 0.001 seconds for one example unless you're
connecting to an external service of some sort. Although that's what
I'm seeing on Mac/Linux. Any Windows users wanna report on the times
you're seeing?

What IDE are you using?

>
> On Oct 9, 10:22 pm, David Chelimsky  wrote:
>
>
>
> > On Oct 9, 8:32 pm, egervari  wrote:
>
> > > I'm just learning my way through ruby and rails to learn it. One thing
> > > I noticed is that testing 1 spec class with 1 test takes about 20
> > > seconds. It's not even using any rails functionality at all. I am just
> > > concatenating some strings together and doing some math...
>
> > > Contrast this with JUnit or ScalaTest... and I could have ran an
> > > entire suit of thousands of tests in this amount of time.
>
> > > One of the reasons I hated grails (I played with it about a year ago)
> > > was that tests ran rediculously slow, so the test/feedback cycle was
> > > horrendous... and I just refused to put up with that.
>
> > > People knock Java/Spring/Hibernate, but you can have a fully tiered,
> > > database-driven app that populates 100-150 rows of data per test that
> > > runs 1000+ tests in under 60 seconds.
>
> > > Given that knowledge... 20 seconds for 1 test that does nothing seems
> > > very, very wrong. Any way I can speed this up?
>
> > Even in the worst case I've experienced it's been a few seconds of
> > start-up overhead, nothing close to 20. What versions of rspec and
> > rails are you using? What command are you using to run the spec? What
> > OS, ruby version, etc?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-1.3.1 and rspec-rails-1.3.3 are released!

2010-10-09 Thread David Chelimsky
I just released rspec-1.3.1 and rspec-rails-1.3.3.

These are mostly bug fixes that have been sitting around for all to long as I 
focused on rspec-2 (coming very soon).

Report issues for rspec[-rails]-1.x to 
https://rspec.lighthouseapp.com/projects/5645.

Docs:
http://rspec.info/
http://rdoc.info/gems/rspec/1.3.1/frames
http://rdoc.info/gems/rspec-rails/1.3.3/frames

Cheers,
David

=== rspec-1.3.1 / 2010-10-09

* enhancements
  * Array =~ matcher works with subclasses of Array (Matthew Peychich & Pat 
Maddox)
  * config.suppress_deprecation_warnings!

* bug fixes
  * QuitBacktraceTweaker no longer eats all paths with 'lib'
(Tim Harper - #912)
  * Fix delegation of stubbed values on superclass class-level methods.
(Scott Taylor - #496 - #957)
  * Fix pending to work with ruby-1.9

* deprecations
  * share_as (will be removed from rspec-core-2.0)
  * simple_matcher (will be removed from rspec-core-2.0)

=== rspec-rails-1.3.3 / 2010-10-09

* enhancements
  * replace use of 'returning' with 'tap'

* bug fixes
  * support message expectation on template.render with locals (Sergey
Nebolsin). Closes #941.
  * helper instance variable no longer persists across examples
(alex rothenberg). Closes #627.
  * mock_model stubs marked_for_destruction? (returns false).


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Why is RSpec so slow with Rails 3?

2010-10-09 Thread David Chelimsky
On Oct 9, 8:32 pm, egervari  wrote:
> I'm just learning my way through ruby and rails to learn it. One thing
> I noticed is that testing 1 spec class with 1 test takes about 20
> seconds. It's not even using any rails functionality at all. I am just
> concatenating some strings together and doing some math...
>
> Contrast this with JUnit or ScalaTest... and I could have ran an
> entire suit of thousands of tests in this amount of time.
>
> One of the reasons I hated grails (I played with it about a year ago)
> was that tests ran rediculously slow, so the test/feedback cycle was
> horrendous... and I just refused to put up with that.
>
> People knock Java/Spring/Hibernate, but you can have a fully tiered,
> database-driven app that populates 100-150 rows of data per test that
> runs 1000+ tests in under 60 seconds.
>
> Given that knowledge... 20 seconds for 1 test that does nothing seems
> very, very wrong. Any way I can speed this up?

Even in the worst case I've experienced it's been a few seconds of
start-up overhead, nothing close to 20. What versions of rspec and
rails are you using? What command are you using to run the spec? What
OS, ruby version, etc?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.0.0.rc is released

2010-10-04 Thread David Chelimsky
rspec-2.0.0.rc is released!

See http://blog.davidchelimsky.net/2010/07/01/rspec-2-documentation/ for links 
to all sorts of documentation on rspec-2.

Plan is to release rspec-2.0.0 (final) within the next week, so please install, 
upgrade, etc, and report issues to:

http://github.com/rspec/rspec-core/issues
http://github.com/rspec/rspec-expectations/issues
http://github.com/rspec/rspec-mocks/issues
http://github.com/rspec/rspec-rails/issues

Many thinks to all of the contributors who got us here!

==
### rspec-core-2.0.0.rc / 2010-10-05

[full 
changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.beta.22...v2.0.0.rc)

* Enhancements
  * implicitly require unknown formatters so you don't have to require the
file explicitly on the commmand line (Michael Grosser) 
  * add --out/-o option to assign output target
  * added fail_fast configuration option to abort on first failure
  * support a Hash subject (its([:key]) { should == value }) (Josep M. Bach)

* Bug fixes
  * Explicitly require rspec version to fix broken rdoc task (Hans de Graaff)
  * Ignore backtrace lines that come from other languages, like Java or
Javascript (Charles Lowell)
  * Rake task now does what is expected when setting (or not setting)
fail_on_error and verbose
  * Fix bug in which before/after(:all) hooks were running on excluded nested
groups (Myron Marston)
  * Fix before(:all) error handling so that it fails examples in nested groups,
too (Myron Marston)
==
### rspec-expectations-2.0.0.rc / 2010-10-05

[full 
changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.22...v2.0.0.rc)

* Enhancements
  * require 'rspec/expectations' in a T::U or MiniUnit suite (Josep M. Bach)

* Bug fixes
  * change by 0 passes/fails correctly (Len Smith)
  * Add description to satisfy matcher
==
### rspec-mocks-2.0.0.rc / 2010-10-05

[full 
changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.22...v2.0.0.rc)

* Enhancements
  * support passing a block to an expecttation block (Nicolas Braem)
* obj.should_receive(:msg) {|&block| ... }

* Bug fixes
  * Fix YAML serialization of stub (Myron Marston)
  * Fix rdoc rake task (Hans de Graaff)
==
### rspec-rails-2.0.0.rc / 2010-10-05

[full 
changelog](http://github.com/rspec/rspec-rails/compare/v2.0.0.beta.22...v2.0.0.rc)

* Enhancements
  * add --webrat-matchers flag to scaffold generator (for view specs)
  * separate ActiveModel and ActiveRecord APIs in mock_model and stub_model
  * ControllerExampleGroup uses controller as the implicit subject by default 
(Paul Rosania)

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-1.3.1.rc and rspec-rails-1.3.3.rc are released!

2010-10-03 Thread David Chelimsky
rspec-1.3.1.rc and rspec-rails-1.3.3.rc are released!

These are release candidate gems for updates 1.x series, including some bug 
fixes and deprecation warnings for functionality that will be removed in 
rspec-2.

Barring unexpected complications, I'll release final versions of these gems 
within the next week.

Cheers,
David

===
rspec-1.3.1 (rc)

* enhancements
  * Array =~ matcher works with subclasses of Array (Matthew Peychich & Pat 
Maddox)
  * config.suppress_deprecation_warnings!

* bug fixes
  * QuitBacktraceTweaker no longer eats all paths with 'lib'
(Tim Harper - #912)
  * Fix delegation of stubbed values on superclass class-level methods.
(Scott Taylor - #496 - #957)
  * Fix pending to work with ruby-1.9

* deprecations
  * share_as (will be removed from rspec-core-2.0)
  * simple_matcher (will be removed from rspec-core-2.0)

===
rspec-rails-1.3.3 (rc)

* enhancements
  * replace use of 'returning' with 'tap' (to quite rails-2.3.9 deprecation 
warnings)

* bug fixes
  * support message expectation on template.render with locals (Sergey
Nebolsin). Closes #941.
  * helper instance variable no longer persists across examples
(alex rothenberg). Closes #627.
  * mock_model stubs marked_for_destruction? (returns false).
===

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] rspec-2.0.0.beta.22 has been released!

2010-09-12 Thread David Chelimsky
rspec-2.0.0.beta.22 has been released!

We're getting very close to a 2.0 release candidate, so if you're not already 
using rspec-2 (with or without rails-3), now is the time to start. I need your 
feedback, so from here on in I'll be sending out announcements and release 
notes for each beta release.

As for rspec-2 with rails-2, there are a few efforts underway to make that 
work, but that will be in the form of a separate gem and our priority is 
getting rspec-2 out the door.

Please report issues or submit pull requests (yes, pull requests are fine now 
that github has integrated them so well with issues) to the appropriate repos:

http://github.com/rspec/rspec-core/issues
http://github.com/rspec/rspec-expectations/issues
http://github.com/rspec/rspec-mocks/issues
http://github.com/rspec/rspec-rails/issues

Below are release notes for each gem in this beta release, drawn from the 
nascent History.md files in each project.

Thanks, and enjoy!
David and the RSpec Development Team

==
rspec-core-2.0.0.beta.22 / 2010-09-12

full changelog: 
http://github.com/rspec/rspec-core/compare/v2.0.0.beta.20...v2.0.0.beta.22

• Enhancements
• removed at_exit hook
• CTRL-C stops the run (almost) immediately
• first it cleans things up by running the appropriate 
after(:all) and after(:suite) hooks
• then it reports on any examples that have already run
• cleaned up rake task
• generate correct task under variety of conditions
• options are more consistent
• deprecated redundant options
• run 'bundle exec autotest' when Gemfile is present
• support ERB in .rspec options files (Justin Ko)
• depend on bundler for development tasks (Myron Marsten)
• add example_group_finished to formatters and reporter (Roman 
Chernyatchik)

• Bug fixes
• support paths with spaces when using autotest (Andreas 
Neuhaus)
• fix module_exec with ruby 1.8.6 (Myron Marsten)
• remove context method from top-level
• was conflicting with irb, for example
• errors in before(:all) are now reported correctly (Chad 
Humphries)

• Removals
• removed -o --options-file command line option
• use ./.rspec and ~/.rspec
==
rspec-expectations-2.0.0.beta.22 / 2010-09-12

full changelog: 
http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.20...v2.0.0.beta.22
  

• Enhancements
• diffing improvements
• diff multiline strings
• don't diff single line strings
• don't diff numbers (silly)
• diff regexp + multiline string

• Bug fixes
• should[_not] change now handles boolean values correctly
==
rspec-mocks-2.0.0.beta.22 / 2010-09-12

full changelog: 
http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.20...v2.0.0.beta.22

• Bug fixes
• fixed regression that broke obj.stub_chain(:a, :b => :c)
• fixed regression that broke obj.stub_chain(:a, :b) { :c }
• respond_to? always returns true when using as_null_object
==
2.0.0.beta.22 / 2010-09-12

full changelog: 
http://github.com/rspec/rspec-rails/compare/v2.0.0.beta.20...v2.0.0.beta.22

• Enhancements
• autotest mapping improvements (Andreas Neuhaus)

• Bug fixes
• delegate flunk to assertion delegate
==


-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] Re: Controller methods over instance variables?

2010-02-08 Thread David Chelimsky


On Feb 8, 4:44 am, Andrew France  wrote:
> Hi,
>
> I was thinking whether it would be more elegant for a view to call
> methods on the controller rather than rely on instance variables. I'm
> not really sure what the answer is so thought I would throw it out
> here.
> Perhaps with a basic DSL that makes it explicit what the controller is
> setting, like:
>
> class BooksController < ActionController::Base
>   var :book do
>     Book.find(params[:id])
>   end
> end
>
> where var:
>
> class ApplicationController..
>   def self.var(name, &block)
>     define_method(name, block)
>     helper_method(name)
>     # Perhaps memoize too?
>   end
> end
>
> Does this violate the rule that the controller should be driving the
> view? Any major disadvantages you can see?

I like the idea for several reasons, not the least of which is that we
use methods in partials. This approach makes it easier to move stuff
around.

FYI - there's already a gem that does this with pretty much the same
syntax you proposed: http://github.com/voxdolo/decent_exposure.

Cheers,
David

> Regards,
> Andrew

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] [ANN] rspec-rails 1.3.0 Released

2010-01-11 Thread David Chelimsky
rspec-rails version 1.3.0 has been released!

* 
* 
* 
* 
* 

Behaviour Driven Development for Ruby on Rails.

Changes:

### Version 1.3.0 / 2010-01-11

* enhancements
  * use stub() instead of stub!() in generators
  * generate gem config in test.rb with 'script/generate rspec'
-- 

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.

To post to this group, send email to rubyonrails-t...@googlegroups.com.

To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] [ANN] rspec 1.3.0 Released

2010-01-11 Thread David Chelimsky
rspec version 1.3.0 has been released!

* <http://rspec.info>
* <http://rubyforge.org/projects/rspec>
* <http://github.com/dchelimsky/rspec/wikis>
* 
* 

Behaviour Driven Development for Ruby.

Changes:

### Version 1.3.0 / 2010-01-11

* enhancements
  * capture ExpectationNotMet error by default in matcher DSL
* supports wrapping other expectations
  * added match_unless_raises to matcher DSL
* supports easy wrapping of t/u assertions in matchers
* thanks to Chad Fowler and Glenn Vanderburg for the name
  * add chain to matcher DSL (Joe Ferris - #935)
* see rdoc for Spec::Matchers
  * and_yield provides configurable eval_context
    * Eric Meyer & David Chelimsky
  * CTRL-C actually stops execution! (Bryan Helmkamp - #911)
  * make drb port configurable (Chris Flipse - #875)
  * changed raise_error to raise_exception (#933)
* kept raise_error aliased, so this is completely
  backwards compatible

* bug fixes
  * don't define top-level context() method when running in IRB (#899)
  * remove Ruby warning for uninitialized ivar (Bryan Helmkamp - #892)
  * fully qualify reference to Default (Alex Sharp - #895)
  * use runtime version of Test::Unit::VERSION in incompatibility message
(Ryan Bigg - #916)
  * quote paths in RSpec's own specs so people running in paths with
spaces in them can achieve green too (Ryan Bigg - #917)
  * ensure drb specs run when EADDRNOTAVAIL (Michael Klett - #881)
  * throw_symbol matcher correctly bubbles errors up (#918)
  * make Rakefile work without Cucumber installed (#919 - devrandom)
  * escape . in regexp (#925)
  * align be_true and be_false with Ruby's conditional semantics (#931)
  * print duplicate nested descriptions (when appropriate) (#936)
-- 

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.

To post to this group, send email to rubyonrails-t...@googlegroups.com.

To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.



[Rails] [ANN] rspec-rails 1.2.9 Released

2009-10-05 Thread David Chelimsky

rspec-rails version 1.2.9 has been released!

* 
* 
* 
* 
* 

Behaviour Driven Development for Ruby on Rails.

Changes:

### Version 1.2.9 / 2009-10-05

* enhancements
  * added route_to and be_routable matchers (Randy Harmon). Closes #843.
  * Provide better failure message for render_template when redirected (Josh
Nichols). Closes #885.
  * generated specs require 'spec_helper'

* bug fixes
  * pass the correct args to super in controller#render depending on the rails
version (Lucas Carlson). Closes #865.
  * use Rack::Utils.parse_query to convert query strings to hashes. Closes #872.
  * errors correctly bubble up when a controller spec in isolation mode
requests a non-existent action/template
* no error if either action or template exist
* error if neither exist
* Closes #888.

* removals
  * spec_server has been removed in favor of spork.
* You can still use the --drb flag, but you've got to install the spork
  gem.
* Windows users who cannot use the spork gem can install the spec_server
  from http://github.com/dchelimsky/spec_server

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec 1.2.9 Released

2009-10-05 Thread David Chelimsky

rspec version 1.2.9 has been released!

* 
* 
* 
* 
* 

Behaviour Driven Development for Ruby.

Changes:

### Version 1.2.9 / 2009-10-05

* enhancements
  * manage backtrace-ignore patterns with Spec::Runner.configure (Martin
Emde). Closes #870.
  * friendly mock argument expectation failure message (Tim Harper). Closes
#868.
  * added double() as alias for stub() and mock()
  * failure messages for doubles, mocks and stubs use the right name
  * add let() method to assign memoized attributes (suggestion from Stuart
Halloway). Closes #857.
  * add its method so you can say:
  describe Array do
its(:length) { should == 0 }
(Stephen Touset). Closes #833
  * spec command automatically uses spec/spec.opts if it is present
(suggestion from Yehuda Katz)
  * rspec now adds PROJECT_ROOT/lib and PROJECT_ROOT/spec to the load path
* determines PROJECT_ROOT by recursing up until it finds a directory
  that has a ./spec directory (thanks to Scott Taylor)
* supports require 'spec_helper'
* supports running specs from the PROJECT_ROOT or any directory
  below it
* closes #733
  * better handling of determining test names in test/unit/interop mode
* Joe Ferris
* closes #854

* bug fixes

  * Fixed problem with colorized output when writing to a file
* Corey Ehmke
* closes #777

* not really a bug fix or enhancement
  * temporarily moved heckle feature to features-pending (waiting to see what
happens with

http://rubyforge.org/tracker/index.php?func=detail&aid=26786&group_id=1513&atid=5921)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec and rspec-rails 1.2.9.rc1 Released

2009-09-14 Thread David Chelimsky

rspec and rspec-rails version 1.2.9.rc1 have been released!
===

We're using the new rubygems prerelease feature to do proper release
candidates. This feature was introduced to rubygems a couple of versions back,
but I'd recommend updating to rubygems-1.3.5 before installing the rspec
prerelease gems.

For those unfamiliar with this new rubygems feature, you have to add the
--prerelease flat in order to see and install these gems:

$ gem search --remote --prerelease rspec

  *** REMOTE GEMS ***

  rspec (1.2.9.rc1)
  rspec-rails (1.2.9.rc1)

$ [sudo] gem install --prerelease rspec
$ [sudo] gem install --prerelease rspec-rails

This way only those who choose to install the prerelease gems will get them,
while those who exclude the --prerelease flag will get the previous final
release (rspec-1.2.8, rspec-rails-1.2.7.1).

Once you install the prerelease gems, Rubygems will treat 1.2.9.rc1 as a
higher version than 1.2.8, but a lower version than 1.2.9. That way when we do
the final release you'll be able to just install 1.2.9 and it will take its
rightful place ahead of 1.2.9.rc1 without you having to uninstall rc1.

I invite you to install these prerelease gems and report any issues you run
into to http://rspec.lighthouseapp.com/rspec. Advanced thanks to those who
help the rest by breaking these in.

Cheers,
David

===

Behaviour Driven Development for Ruby and Ruby on Rails

### rspec-1.2.9-rc1

* enhancements
  * manage backtrace-ignore patterns with Spec::Runner.configure
(Martin Emde). Closes #870.
  * friendly mock argument expectation failure message (Tim Harper).
Closes #868.
  * added double() as alias for stub() and mock()
  * failure messages for doubles, mocks and stubs use the right name
  * add let() method to assign memoized attributes (suggestion from
Stuart Halloway). Closes #857.
  * add its method so you can say:
  describe Array do
its(:length) { should == 0 }
(Stephen Touset). Closes #833
  * spec command automatically uses spec/spec.opts if it is present
(suggestion from Yehuda Katz)
  * rspec now adds PROJECT_ROOT/lib and PROJECT_ROOT/spec to the load path
* determines PROJECT_ROOT by recursing up until it finds a directory
  that has a ./spec directory (thanks to Scott Taylor)
* supports require 'spec_helper'
* supports running specs from the PROJECT_ROOT or any directory
  below it
* closes #733

* not really a bug fix or enhancement
  * temporarily moved heckle feature to features-pending (waiting to see what
happens with

http://rubyforge.org/tracker/index.php?func=detail&aid=26786&group_id=1513&atid=5921)

### rspec-rails-1.2.9-rc1

* enhancements
  * added route_to and be_routable matchers (Randy Harmon). Closes #843.
  * Provide better failure message for render_template when redirected
(Josh Nichols). Closes #885.
  * generated specs require 'spec_helper'

* bug fixes
  * pass the correct args to super in controller#render depending on
the rails version (Lucas Carlson). Closes #865.
  * use Rack::Utils.parse_query to convert query strings to hashes. Closes #872.
  * errors correctly bubble up when a controller spec in isolation
mode requests a non-existent action/template
* no error if either action or template exist
* error if neither exist
* Closes #888.

* removals
  * spec_server has been removed in favor of spork.
* You can still use the --drb flag, but you've got to install the spork gem.
* Windows users who cannot use the spork gem can install the
spec_server from
  * http://github.com/dchelimsky/spec_server

* 
* 
* 
* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec 1.2.8 Released

2009-07-16 Thread David Chelimsky

rspec version 1.2.8 has been released!

* 
* 
* 
* 
* 

Behaviour Driven Development for Ruby.

Changes:

### Version 1.2.8 / 2008-07-16

* enhancements
  * better messages for should[_not] be_nil (Chad Humphries and Rob Sanheim)
  * should and should_not accept optional custom message
(suggestion from Rob Sanheim)
* result.should be_nil, "expected result to be nil"
  * added 'spec/stubs/cucumber' to plug RSpec's stubbing framework into
Cucumber scenarios.
  * added unstub method to remove a stub mid-example (Scott Taylor). Closes
#853.
  * add more readable diff when expected and actual are hashes (Ryan Bigg).
Closes #848.

* bug fixes
  * fixed --line option for ruby 1.9.1
  * fix stub_chain conflict between two chains starting with the same message
(Mike Rohland). Closes #846.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: [ANN] rspec-rails 1.2.7 Released

2009-06-22 Thread David Chelimsky

I just pushed 1.2.7.1 to fix a bug in "script/generate rspec". Please
use this instead of the 1.2.7 gem.

Cheers,
David

On Mon, Jun 22, 2009 at 9:21 PM, David Chelimsky wrote:
> rspec-rails-1.2.7 has been released!
>
> Behaviour Driven Development for Ruby on Rails.
>
> Changes:
>
> ### Version 1.2.7 / 2009-06-22
>
> * enhancements
>  * alias :stub!, :stub so rspec-rails extensions of rspec stubs can use the
>    same syntax as rspec (core)
>  * integration specs (Ben Mabey and David Chelimsky)
>  * added support for references and belongs_to generated model specs (José
>    Valim). Closes #792.
>  * add discovery for autotest-rails to keep compatible with ZenTest-4.0.0
>    (Ryan Davis). Closes #838.
>  * controller specs in isolation mode don't care whether the file exists
>    anymore!
>
> * bug fixes
>  * allow rspec-rails to work without ActiveRecord. Closes #810.
>  * fix bug with have() matcher failure message (Dave Giunta). Closes #818.
>  * fix bug where render_template('new') would pass if 'newer' was rendered
>    (or anything that started with 'new')
>
> * deprecations
>  * spec_server is now deprecated - use spork instead (gem install spork).
>    Closes #827.
>
> * <http://rspec.info>
> * <http://rubyforge.org/projects/rspec>
> * <http://github.com/dchelimsky/rspec-rails>
> * <http://wiki.github.com/dchelimsky/rspec/rails>
> * 
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec-rails 1.2.7 Released

2009-06-22 Thread David Chelimsky

rspec-rails-1.2.7 has been released!

Behaviour Driven Development for Ruby on Rails.

Changes:

### Version 1.2.7 / 2009-06-22

* enhancements
  * alias :stub!, :stub so rspec-rails extensions of rspec stubs can use the
same syntax as rspec (core)
  * integration specs (Ben Mabey and David Chelimsky)
  * added support for references and belongs_to generated model specs (José
Valim). Closes #792.
  * add discovery for autotest-rails to keep compatible with ZenTest-4.0.0
(Ryan Davis). Closes #838.
  * controller specs in isolation mode don't care whether the file exists
anymore!

* bug fixes
  * allow rspec-rails to work without ActiveRecord. Closes #810.
  * fix bug with have() matcher failure message (Dave Giunta). Closes #818.
  * fix bug where render_template('new') would pass if 'newer' was rendered
(or anything that started with 'new')

* deprecations
  * spec_server is now deprecated - use spork instead (gem install spork).
Closes #827.

* <http://rspec.info>
* <http://rubyforge.org/projects/rspec>
* <http://github.com/dchelimsky/rspec-rails>
* <http://wiki.github.com/dchelimsky/rspec/rails>
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec 1.2.7 Released

2009-06-22 Thread David Chelimsky

rspec-1.2.7 has been released!

* 
* 
* 
* 
* 

Behaviour Driven Development for Ruby.

Changes:

### Version 1.2.7 / 2009-06-22

* enhancments
  * added support for fakes using obj.stub(:method) { # implementation }
  * allow subject { self } (Jarmo Pertman). Closes #816.
  * friendly error message when a matcher returns nil on a failure message
  * add ruby_cmd option to SpecTask (Rick DeNatale). Closes #823.
* also added missing specs for SpecTask - thanks Rick!
  * add support for generating matchers with fluent interfaces with the
Matcher DSL

* bug fixes
  * NegativeOperatorMatcher now returns false (Wesley Beary). Closes #812.
  * derive MockExpectationError from Exception rather than StandardError
(Kerry Buckley). Closes #830.
  * fix bug where multi-line failure messages weren't getting picked up by
autotest (Jarmo Pertman). Closes #832.
  * --line_number now works for it { should xxx } format (assist from Fred
Lee)
  * warn instead of raise when there is no description supplied for an
example. Closes #840.

* 
* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec-rails 1.2.6 Released

2009-04-30 Thread David Chelimsky

rspec-rails version 1.2.6 has been released!

Behaviour Driven Development for Ruby on Rails.

### Version 1.2.6 / 2009-04-30

* bug fixes
  * restored rake tasks for rspec[-rails] as plugins

* 
* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec 1.2.6 Released

2009-04-30 Thread David Chelimsky

rspec version 1.2.6 has been released!

Behaviour Driven Development for Ruby.

Changes:

### Version 1.2.6 / 2009-04-30

* bug fixes
  * gem actually built with spec executable

* 
* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec-rails 1.2.5 Released

2009-04-29 Thread David Chelimsky

rspec-rails version 1.2.5 has been released!

* 
* 
* 
* 
* 

Behaviour Driven Development for Ruby on Rails.

Changes:

### Version 1.2.5 / 2009-04-29

* enhancements
  * support :xml and :strict config options for have_tag matcher (patch from
Peer Allan and Max Murphy). Closes #783.

* bug fixes
  * Fixed a small typo that makes rake stats fail (José Valim). Closes #802.
  * link_to and friends are available to ViewExampleGroup again
(J.B. Rainsberger). Closes #787.
  * spec_server works correctly with rails 2.3 again (Neil Buckley).
Closes #759.

* 
* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec 1.2.5 Released

2009-04-29 Thread David Chelimsky

rspec version 1.2.5 has been released!

* 
* 
* 
* 

Behaviour Driven Development for Ruby.

Changes:

### Version 1.2.5 / 2009-04-29

* enhancements

  * name argument to mock/stub is now optional (closes #782)
* you can do mock(:foo => "woo", :bar => "car")
  * expect { this_block }.to
change{this.expression}.from(old_value).to(new_value)
  * expect { this_block }.to raise_error
  * better failiure messages for equal matcher (James Byrne). Closes #804.
  * add stub_chain method
* also alias_method :stub, :stub!, so you can stub with less bang
  * added options to example_group_proxy

* bug fixes

  * ensure correct handling of ordered message expectations with duplicate
expectations (NigelThorne). Closes #793.
  * get matcher backwards compat working w/ ruby 19
  * don't define instance_exec unless it is not defined
* was doing a version check, but turns out that didn't cover alternative
  implementations like JRuby
  * fix bug where in some circumstances, loading lib/spec/interop/test.rb
raised an error (tsechingho). Closes #803.
  * make sure specs only run against spec server when using drb (patch
from Chuck Grindel). Closes #797.
  * remove deprecation warning in example_pending when using
FailingExamplesFormatter. Closes #794.
  * Access explicit subject from nested groups of arbitrary depth. Closes #756.

* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec 1.2.4 Released

2009-04-15 Thread David Chelimsky

rspec version 1.2.4 has been released!

Be sure to check History.rdoc and Updgrade.rdoc at
http://rspec.rubyforge.org/rspec/1.2.4/ before upgrading.

* 
* 
* 
* 

Behaviour Driven Development for Ruby.

Changes:

### Version 1.2.4

* bug fix
  * just one - update the manifest

### Version 1.2.3

* enhancements
  * support for specifying single examples with colon syntax. Closes #712.
(Ben Mabey)
* you can now say "spec some_spec.rb:12" in addition to "spec some_spec.rb
  --line 12"
  * run specs locally with --drb if no drb server is running. Closes #780.
* still prints "No server running" to stderr

* bug fixes
  * support expectations on DelegateClass (Clifford T. Matthews). Closes #48.
  * Fixed match_array blows up if elements can't be sorted (Jeff
Dean). Closes #779.

* deprecations
  * BaseFormatter#add_example_group (use #example_group_started instead)
  * ExampleGroupProxy#backtrace (use #location instead)
  * ExampleProxy#backtrace (use #location instead)
  * BaseFormatter#example_pending now expects two arguments. The third
argument is deprecated.
  * ExampleGroupProxy#filtered_description. This was only used in one place
internally, and was a confusing solution to the problem. If you've got a
custom formatter that uses it, you can just use
ExampleGroupProxy#description and modify it directly.
  * predicate_matchers (use the new Matcher DSL instead)
  * Spec::Matchers.create (use Spec::Matchers.define instead)

* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec-rails 1.2.2 Released

2009-03-22 Thread David Chelimsky

rspec-rails version 1.2.2 has been released!

* 
* 
* 
* 
* 

Behaviour Driven Development for Ruby on Rails.

Changes:

### Version 1.2.2 / 2009-03-22

No changes in this release, but aligns with the rspec-1.2.2 release.

* 
* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec 1.2.2 Released

2009-03-22 Thread David Chelimsky

rspec version 1.2.2 has been released!

* 
* 
* 
* 

Behaviour Driven Development for Ruby.

Changes:

### Version 1.2.2 / 2009-03-22

Bug-fix release (fixes regression introduced in 1.2.1)

* bug fixes

  * fixed bug in which spec_parser raised an error for custom example group
base classes

* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec 1.2.1 Released

2009-03-22 Thread David Chelimsky

rspec version 1.2.1 has been released!

* 
* 
* 
* 

Behaviour Driven Development for Ruby.

Changes:

### Version 1.2.1 / 2009-03-22

This is a bug-fix release, recommended for anybody who has already upgraded to
rspec-1.2.0.

See Upgrade.rdoc for information about upgrading to rspec-1.2.1

* enhancments

 * matchers, including the new DSL, easily added to your test/unit tests
 * added support for 0 to n args in matcher DSL
 * restored loading rubygems when necessary
   * if you really don't want to use rubygems, you
     can set an NO_RUBYGEMS environment
     variable, and RSpec won't force it on you.
 * added -u/--debugger option (Rick DeNatale) #262.
   * just add "debugger" anywhere in your code and run spec
path/to/code --debugger
 * rename ExampleDescription to ExampleProxy
 * pass ExampleProxy to example_started(). Closes #738, #743
   * thanks to Tobias Grimm (Eclipse) fort the patch and Roman Chernyatchik
     (JetBrains, RubyMine) for the assist

* bug fixes

 * subject (implicit or explicit) is now properly inherited by nested
groups. Closes #744.

* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec-rails 1.2.1 Released

2009-03-22 Thread David Chelimsky

rspec-rails version 1.2.1 has been released!

* 
* 
* 
* 
* 

Behaviour Driven Development for Ruby on Rails.

Changes:

### Version 1.2.1 / 2009-03-22

This is a bug-fix release, recommended for anybody who has already upgraded to
rspec-rails-1.2.0 or is upgrading to rails-2.3.2

See Upgrade.rdoc for information about upgrading to rspec-rails-1.2.1

* enhancements

  * more cleanup of internals (reducing dependency on rspec-core)
  * don't require config/environments more than once
  * autotest includes spec/routing directory (Matt Peterson). Closes #739.
  * display helpful messages when installing rspec-rails running
script/generate rspec
* thanks for Dr Nic for the pointers
  * restored require 'rubygems' where needed
* export NO_RUBYGEMS=true if you don't use rubygems

* bug fixes

  * fix scoping issues in rspec-rails' own suite for ruby 1.9.1 (Matthias
Hennemeyer). Closes #717.
  * rake stats no longer hides test directories. Closes #748.
  * fixed regression that was introduced in 1.2 in which controller_name
failed to override the controller class passed to describe() (patches from
Aaron Gibralter and Zach Dennis). Closes #732.

* 
* 
* 
* 
* 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Problem running autotest in rails 2.3

2009-03-22 Thread David Chelimsky



On Mar 21, 11:58 pm, Phor Gruber 
wrote:
> People,
>
> I'm trying to run autotest on rails 2.3
>
> I get a NoMethodError.
>
> Here is what I see:
>
> Sat Mar 21 20:47 /b/tmp/myfc23 maco$
> Sat Mar 21 20:47 /b/tmp/myfc23 maco$ autotest
> loading autotest/rails_rspec
> ./vendor/plugins/rspec/lib/autotest/rspec.rb:24:in `initialize':
> undefined method `failed_results_re=' for
> # (NoMethodError)
>         from
> /pt/r1/lib/ruby/gems/1.8/gems/ZenTest-3.8.0/lib/autotest.rb:126:in `new'
>         from
> /pt/r1/lib/ruby/gems/1.8/gems/ZenTest-3.8.0/lib/autotest.rb:126:in `run'
>         from /pt/r1/lib/ruby/gems/1.8/gems/ZenTest-3.8.0/bin/autotest:48
>         from /pt/r1/bin/autotest:19:in `load'
>         from /pt/r1/bin/autotest:19
> Sat Mar 21 20:47 /b/tmp/myfc23 maco$
> Sat Mar 21 20:47 /b/tmp/myfc23 maco$
>
> Here is info about my rails:
>
> Sat Mar 21 20:47 /b/tmp/myfc23 maco$
> Sat Mar 21 20:47 /b/tmp/myfc23 maco$
> Sat Mar 21 20:47 /b/tmp/myfc23 maco$ script/about
> About your application's environment
> Ruby version              1.8.7 (i686-darwin9.6.2)
> RubyGems version          1.3.1
> Rack version              1.0 bundled
> Rails version             2.3.2
> Active Record version     2.3.2
> Action Pack version       2.3.2
> Active Resource version   2.3.2
> Action Mailer version     2.3.2
> Active Support version    2.3.2
> Application root          /b/tmp/myfc23
> Environment               development
> Database adapter          sqlite3
> Database schema version   2
> Sat Mar 21 20:51 /b/tmp/myfc23 maco$
>
> Here is a list of my gems:
>
> *** LOCAL GEMS ***
>
> actionmailer (2.3.2, 2.2.2)
> actionpack (2.3.2, 2.2.2)
> activerecord (2.3.2, 2.2.2)
> activeresource (2.3.2, 2.2.2)
> activesupport (2.3.2, 2.2.2)
> cgi_multipart_eof_fix (2.5.0)
> chronic (0.2.3)
> columnize (0.3.0)
> daemons (1.0.10)
> darkfish-rdoc (1.1.5)
> diff-lcs (1.1.2)
> extlib (0.9.10)
> fastthread (1.0.1)
> gem_plugin (0.2.3)
> highline (1.5.0)
> hoe (1.9.0)
> hpricot (0.6.164)
> libxml-ruby (0.9.8)
> linecache (0.43)
> mongrel (1.1.5)
> mysql (2.7)
> newgem (1.2.3)
> rack (0.9.1)
> rails (2.3.2, 2.2.2)
> rake (0.8.4, 0.8.3)
> rcov (0.8.1.2.0)
> rdoc (2.4.1)
> RedCloth (4.1.9)
> rhodes (0.3.0)
> rspec (1.2.0, 1.1.12)
> rspec-rails (1.2.0, 1.1.12)
> rubigen (1.5.2)
> ruby-debug (0.10.3)
> ruby-debug-base (0.10.3)
> rubyforge (1.0.3)
> sqlite3-ruby (1.2.4, 1.2.3)
> syntax (1.0.0)
> templater (0.5.0)
> ZenTest (3.8.0)

I think that updating ZenTest (currently at 4.0) will solve this.

Cheers,
David

>
> Any tips on debugging this?
>
> -b
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec 1.2.0 Released

2009-03-15 Thread David Chelimsky

rspec version 1.2.0 has been released!

Behaviour Driven Development for Ruby.

Changes:

### Version 1.2.0

WARNINGS:

  * If you use the ruby command to run specs instead of the spec command, you'll
need to require 'spec/autorun' or they won't run. This won't affect you if
you use the spec command or the Spec::Rake::SpecTask that ships with RSpec.

  * require 'spec/test/unit' to invoke test/unit interop if you're using
RSpec's core (this is handled implicitly with spec-rails)

  * setup and teardown are gone - use before and after instead

* you can still use setup and teardown if you're using
  Test::Unit::TestCase as the base ExampleGroup class (which is implicit
  in rspec-rails)

  * The matcher protocol has been improved. The old protocol is still
supported, so as long as you're not monkey patching rspec's built-in
matchers, or using extension libraries that do, this should not affect
you. If you run into trouble, you'll just need to change:

* failure_message  => failure_message_for_should
* negative_failure_message => failure_message_for_should_not

  * All references to rubygems have been removed from within rspec's code.

* See http://gist.github.com/54177 for rationale and suggestions on
  alternative approaches to loading rubygems

* deprecations

  * BaseTextFormatter#colourize - use colorize_failure instead.
  * BaseTextFormatter#magenta - use red instead.

* enhancements

  * cleaner integration with with heckle-1.4.2
  * allow registering example groups with a path-like key (Pat Maddox)
  * start DRb service at "druby://localhost:0" (Hongli Lai) - See
http://redmine.ruby-lang.org/issues/show/496
  * consistent reporting of errors as failures
  * added spec/test/unit as more intuitive path to loading test/unit interop lib
  * added explicit autorun feature for running specs with ruby command
  * added handling for does_not_match? for matchers that want to know
the context in which they were called
  * lots of ruby 1.9.1 compatibility fixes from Chad Humprhies
  * improved feedback from
be_kind_of/be_a_kind_of/be_instance_of/be_an_instance_of (Jakub
Šťastný)
  * added --format silent (l) option, which is now the default when
running --heckle (Bob Aman)
  * sexy new custom matcher creation (Corey Haines & David Chelimsky -
initial concept by Yehuda Katz)
  * improved matcher protocol - old one is still supported, but new
one is cleaner and prefered

* bug fixes

  * support delegating operator matchers to subject with should_not
  * all arguments are included if --drb is specified in spec.opts
(Neil Buckley). Closes #671.
  * added --autospec option hack (used internally) to get --color to
work when using --drb and autospec.
  * Fixed mock framework failure message bug in which similar calls
were excluded from the output
  * cryptic error message on change.rb when the from value is wrong
(Michael Murray). Closes #706.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] rspec-rails 1.2.0 Released

2009-03-15 Thread David Chelimsky

rspec-rails version 1.2.0 has been released!

* 
* 
* 
* 

Behaviour Driven Development for Ruby on Rails.

Changes:

### Version 1.2.0

IMPORTANT INFORMATION: Due to changes in Rails-2.3, there are some changes
in rspec-rails-1.2.0 that might break some specs in your existing apps. Be
sure to see http://wiki.github.com/dchelimsky/rspec/rails and
http://wiki.github.com/dchelimsky/rspec/upgrades for information about
upgrading.

IMPORTANT: This release includes the following
backwards-compatibility-breaking changes.

* rspec-rails supports rails 2.0.5, 2.1.2 and 2.2.2, and 2.3.1

  * We are no longer supporting 1.x versions of rails.

* expect_render and stub_render have been removed.

  * Both of these methods were deprecated in rspec-rails-1.1.5,
released in Sept, 2008.

* { route_for(args).should == "/path" } now delegates to
assert_generates (in rails)

  * see Upgrade.markdown for more information

* deprecations

  * controller.use_rails_error_handling! is deprecated
* use rescue_action_in_public! (from rails) instead

* enhancements

  * Adding status codes to redirect_to matcher (Damian Janowski). Closes #570.
  * Initialize current URL before executing any examples in a
ViewExampleGroup (Wilson Bilkovich). Closes #654.
  * Support query strings in params_from (Wilson Bilkovich). Closes #652.
  * delegate route_for to assert_recognizes (less brittle)
  * it { should be_valid } (Kakutani). Closes #665.
  * controller is implicit subject in controller specs (Joe Ferris). #686.
  * template is implicit subject in view specs (Joe Ferris). #686.
  * redirect_to and render_template matchers can accept controller or
response (Joe Ferris). Closes #686.
  * generated specs use declarative docstrings
  * rspec_scaffold generator generates layout and stylesheet (per Rails-2.3)
  * add bypass_rescue for controller specs
  * infer template path from the first arg passed to describe in view specs
  * separate routing specs (in spec/routing)

* bug fixes

  * you no longer *have* to load ActionMailer to get specs to run. Closes #650.
  * query_params are now parsed by Rack::Utils.parse_query in
redirect_to matcher. Closes #684.
  * cleaned up spec_server (there was a bunch of pre-rails 2.0
material). Closes #685.
  * rspec's rake tasks are not loaded when running "rake gems" or any
of its subtasks
  * only warn when rspec is not installed when trying to invoke an
rspec rake task
  * support 2 arg version of ActionController::Base#render (reported
by Nathan Wilmes)
  * rake spec:server:start doesn't choke if there is no tmp directory
  * force cache_classes = false when running with spec_server. Closes #287.
  * keep spec_server working against edge rails (Jonathan Tron). Closes #685.
  * create lib/tasks if not present when running script/generate
rspec. Closes #687.
  * fixed regression (and added spec so it won't regress again) where
render => :inline didn't render unless integrate_views was set
  * fixed nil.with_output_buffer bug in helper specs. Closes #719.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] [ANN] The RSpec Book is now in beta

2009-01-29 Thread David Chelimsky

I’m pleased to announce the beta release of the Pragmatic Bookshelf’s  
The RSpec Book: Behaviour Driven Development with RSpec, Cucumber and  
Friends!

It’s been a long time coming, and there’s still a lot of work to do to  
get to print. The beta release has 9 of the 22 chapters we have  
planned. Most of what remains is almost done, but not quite ready to  
release yet. As with all of the Pragmatic beta books, we’ll do regular  
updates every few weeks as we wrap up the remaining chapters and  
incorporate your feedback. And please do provide feedback. We want  
this book to serve you well!

There are six authors involved: Dave Astels, Zach Dennis, Aslak  
Hellesoy, Bryan Helmkamp, Dan North, and me. I'm honored to be in such  
good company here, with the guys who brought us BDD, to the developers  
and maintainers of RSpec, Cucumber and Webrat.

You can read more (and buy the book!) at 
http://www.pragprog.com/titles/achbd/the-rspec-book

On behalf of all the authors, I'd like to extend a special thank you  
to all of you who have contributed to the software and the  
conversation around RSpec, Cucumber, and BDD in general. RSpec would  
be nothing without the community that has evolved around it, so thank  
you, thank you, thank you.

Again, THANK YOU!
David Chelimsky


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: can one test manual transactions in Rspec/UnitTest noting the testing framework wraps its DB work in a transaction & mysql doesn't allow nested transactions?

2009-01-15 Thread David Chelimsky

On Wed, Jan 14, 2009 at 1:27 AM, Greg Hauptmann
 wrote:
> Hi,
>
> Just wondering, can one test manual transactions in Rspec/UnitTest noting
> the testing framework wraps its DB work in a transaction & mysql doesn't
> allow nested transactions?

Wrapping code examples (in rspec) or test methods (in t/u) in a
transaction is the default behavior, but is easily turned off with
config.transactional_fixtures = false.

The name transactional_fixtures is a bit misleading because its really
about wrapping each method in a transaction whether you're using
fixtures or not.

If you do turn this off, however, you'll want some code to truncate
the DB after each example (after(:each) in rspec, teardown in
test/unit) to avoid leaking state across examples.

HTH,
David


>
> --
> Greg
> http://blog.gregnet.org/
>
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: rspec fails when assigning to an ActiveRecord field

2008-10-24 Thread David Chelimsky

On Tue, Oct 21, 2008 at 9:13 AM, leo <[EMAIL PROTECTED]> wrote:
>
> Thanks, I think I understand what you are saying.  When running the
> tests, the @event in line 43 of the controller code is replaced with
> the mock object.  Since it is a mock object, I need to tell the test
> that the mock object can handle a :user_id message.  Can you tell me
> how to do that?  I tried several ways but none of them seemed to work
> and I couldn't find it in the documentation.  If anyone has a link to
> info that would be awesome as I'd rather learn for myself if possible.

http://rspec.info/documentation/mocks/

Cheers,
David


>
> On Oct 19, 6:15 pm, "David Chelimsky" <[EMAIL PROTECTED]> wrote:
>> On Wed, Oct 15, 2008 at 11:48 PM, leo <[EMAIL PROTECTED]> wrote:
>>
>> > HI,
>> > I have a controller action that assigns a user_id to an event record.
>> > The app works fine from the browser.  However, rspec fails and I
>> > cannot figure out why.  I have several tests failing but I'll give an
>> > example created by script/generate rspec_controller.
>> > Any help will be appreciated.
>>
>> > RSPEC test
>> > 102 describe "with invalid params" do
>> > 103
>> > 104   it "should expose a newly created but unsaved event as
>> > @event" do
>> > 105 Event.stub!(:new).with({'these' =>
>> > 'params'}).and_return(mock_event(:save => false))
>> > 106 post :create, :event => {:these => 'params'}
>> > 107 assigns(:event).should equal(mock_event)
>> > 108   end
>>
>> > RSPEC Test result
>>
>> > should expose a newly created but unsaved event as @event
>>
>> >Mock 'Event_1039' received unexpected message :user_id= with (nil)
>>
>> This error message is telling you exactly what you need. In the
>> controller code (below), the #create action sends the #user_id=
>> message to @event, which is the mock_event defined in the code example
>> (above).
>>
>> The mock_event method returns a mock object, which is designed to
>> complain when it receives messages you don't tell it to expect, and so
>> it complains when it receives #user_id=.
>>
>> To eliminate that complaint, you can either set an explicit
>> expectation (if you think that is meaningful in your code example), or
>> you can tell it to ignore all unexpected messages by sending it
>> #as_null_object:
>>
>> mock_event(:save => false).as_null_object
>>
>> Cheers,
>> David
>>
>>
>>
>> >/home/leo/railsprojects/trunk/memorymap/app/controllers/
>> > events_controller.rb:44:in `create'
>> >./spec/controllers/events_controller_spec.rb:106:
>>
>> >42  def create
>> >43@event = Event.new(params[:event])
>> >44@event.user_id = session[:user_id]
>> >45
>> >46respond_to do |format|
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: rspec fails when assigning to an ActiveRecord field

2008-10-19 Thread David Chelimsky

On Wed, Oct 15, 2008 at 11:48 PM, leo <[EMAIL PROTECTED]> wrote:
>
> HI,
> I have a controller action that assigns a user_id to an event record.
> The app works fine from the browser.  However, rspec fails and I
> cannot figure out why.  I have several tests failing but I'll give an
> example created by script/generate rspec_controller.
> Any help will be appreciated.
>
>
>
>
> RSPEC test
> 102 describe "with invalid params" do
> 103
> 104   it "should expose a newly created but unsaved event as
> @event" do
> 105 Event.stub!(:new).with({'these' =>
> 'params'}).and_return(mock_event(:save => false))
> 106 post :create, :event => {:these => 'params'}
> 107 assigns(:event).should equal(mock_event)
> 108   end
>
>
> RSPEC Test result
>
> should expose a newly created but unsaved event as @event
>
>Mock 'Event_1039' received unexpected message :user_id= with (nil)

This error message is telling you exactly what you need. In the
controller code (below), the #create action sends the #user_id=
message to @event, which is the mock_event defined in the code example
(above).

The mock_event method returns a mock object, which is designed to
complain when it receives messages you don't tell it to expect, and so
it complains when it receives #user_id=.

To eliminate that complaint, you can either set an explicit
expectation (if you think that is meaningful in your code example), or
you can tell it to ignore all unexpected messages by sending it
#as_null_object:

mock_event(:save => false).as_null_object

Cheers,
David

>
>/home/leo/railsprojects/trunk/memorymap/app/controllers/
> events_controller.rb:44:in `create'
>./spec/controllers/events_controller_spec.rb:106:
>
>42  def create
>43@event = Event.new(params[:event])
>44@event.user_id = session[:user_id]
>45
>46respond_to do |format|
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: OT: What happened to Rspec Google group?

2008-10-07 Thread David Chelimsky

On Mon, Oct 6, 2008 at 5:12 PM, John Ivanoff <[EMAIL PROTECTED]> wrote:
>
> It disappeared over the weekend. Anybody know what happened?

I have no idea why it's gone, but it was a mirror for the rspec-users
list at rubyforge:

  http://rubyforge.org/mailman/listinfo/rspec-users

Which you can also access through nabble:

  http://www.nabble.com/rspec-users-f17460.html

I'll see if I can find out what happened.

Cheers,
David


>
> http://groups.google.com/group/rspec/
>
> John I
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: rspec story - access session

2008-09-10 Thread David Chelimsky

On Thu, Aug 28, 2008 at 8:41 AM, snitko <[EMAIL PROTECTED]> wrote:
>
> Very simple, but not googlable: how do I access 'session' in my story?
> In rspec controller specs I could just say session[:user] for example,
> but this doesn't work here.

Hi,

There's no support for what you are trying to do. RailsStory, the
object that rspec/rails scenarios run in, is derived from
ActionController::Integration::Session, which is what rails
integration tests run in.

This is a bit confusing, but ActionController::Integration::Session is
a metaphor for an interactive session between a user and the system,
not the browser session object that you can access from your
controllers.

ActionController::Integration::Session doesn't provide access to the
browser session as it is actually designed to let you run more than
one browser session within one test.

Hope that makes sense.

Cheers,
David

ps - feel free to post rspec questions to the rspec-users mailing list
or google group:

http://rubyforge.org/mailman/listinfo/rspec-users
http://groups.google.com/group/rspec

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---