[rspec-users] Autotest/RSpec 1.1.4/Rails 2.1 Infinite Loop?

2008-06-03 Thread Andrew Selder
I just got back from RailsConf, and upgraded on of my development apps  
to 2.1, and now autotest is going into an infinite loop. It runs tests  
continuously instead of waiting for files to be saved before rerunning.


Has anybody else seen this, or know how to get around it?

Thanks,

Andrew

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Build rspec-rails as a gem?

2008-06-03 Thread Ben Mabey

Pat Maddox wrote:

On Mon, Jun 2, 2008 at 11:09 PM, Jose Fernandez <[EMAIL PROTECTED]> wrote:
  

I can't figure out how to build rspec-rails as a gem when just cloned
from github... there isn't any .gemspec file or rake task that does
this. Any help?



rspec-rails is a rails plugin, not a gem.

Pat
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
  


I have needed to use it as a gem before.  Why?  Well, with ticket 
383(http://rspec.lighthouseapp.com/projects/5645/tickets/383-extract-mock_model-out-of-railsexamplegroup)  
David extracted the mocking features for AR so that it could be reused 
easily.  I was writing a merb app that used AR and I quickly began 
missing the mock_model and other mock helpers found in rspec-rails.  So, 
I created a gem out of the plugin, installed it locally in my merb app I 
just required 'spec/rails/mocks'.



The gemspec file I created to do this was:

Gem::Specification.new do |s|
 s.name = %q{rspec-rails}
 s.version = "1.1.4"

 s.specification_version = 2 if s.respond_to? :specification_version=

 s.required_rubygems_version = Gem::Requirement.new(">= 0") if 
s.respond_to? :required_rubygems_version=

 s.authors = ["RSpec Development Team"]
 s.date = %q{2008-05-25}
 s.default_executable = %q{spec}
 s.description = %q{RSpec-Rails is an extension to RSpec to provide a 
better environment for specing rails.}

 s.email = [EMAIL PROTECTED]
 s.extra_rdoc_files = ["README", "CHANGES", "MIT-LICENSE"]
 s.files = ["CHANGES", "MIT-LICENSE", "Rakefile", "README", 
"lib/autotest/discover.rb", "lib/autotest/rails_rspec.rb", 
"lib/spec/rails/example/assigns_hash_proxy.rb", 
"lib/spec/rails/example/controller_example
_group.rb", "lib/spec/rails/example/functional_example_group.rb", 
"lib/spec/rails/example/helper_example_group.rb", 
"lib/spec/rails/example/model_example_group.rb", 
"lib/spec/rails/example/rails_example_group.r
b", "lib/spec/rails/example/render_observer.rb", 
"lib/spec/rails/example/view_example_group.rb", 
"lib/spec/rails/example.rb", 
"lib/spec/rails/extensions/action_controller/base.rb", 
"lib/spec/rails/extensions/ac
tion_controller/rescue.rb", 
"lib/spec/rails/extensions/action_controller/test_response.rb", 
"lib/spec/rails/extensions/action_view/base.rb", 
"lib/spec/rails/extensions/active_record/base.rb", "lib/spec/rails/ex
tensions/object.rb", 
"lib/spec/rails/extensions/spec/example/configuration.rb", 
"lib/spec/rails/extensions/spec/matchers/have.rb", 
"lib/spec/rails/extensions.rb", 
"lib/spec/rails/matchers/assert_select.rb", "li
b/spec/rails/matchers/have_text.rb", 
"lib/spec/rails/matchers/include_text.rb", 
"lib/spec/rails/matchers/redirect_to.rb", 
"lib/spec/rails/matchers/render_template.rb", 
"lib/spec/rails/matchers.rb", "lib/spec/ra
ils/mocks.rb", "lib/spec/rails/story_adapter.rb", 
"lib/spec/rails/version.rb", "lib/spec/rails.rb"]

 s.has_rdoc = true
 s.homepage = %q{http://rspec.rubyforge.org}
 s.rdoc_options = ["--title", "RSpec-Rails", "--line-numbers", 
"--inline-source", "--main", "README"]

 s.require_paths = ["lib"]
 s.rubygems_version = %q{1.1.0}
 s.summary = %q{RSpec-Rails-1.1.4 (build 20080526202855) - BDD for Ruby 
http://rspec.rubyforge.org/}

end




___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Build rspec-rails as a gem?

2008-06-03 Thread David Chelimsky


On Jun 3, 2008, at 11:31 AM, Ben Mabey wrote:


Pat Maddox wrote:
On Mon, Jun 2, 2008 at 11:09 PM, Jose Fernandez <[EMAIL PROTECTED] 
forum.com> wrote:


I can't figure out how to build rspec-rails as a gem when just  
cloned

from github... there isn't any .gemspec file or rake task that does
this. Any help?



rspec-rails is a rails plugin, not a gem.

Pat
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users



I have needed to use it as a gem before.  Why?  Well, with ticket  
383(http://rspec.lighthouseapp.com/projects/5645/tickets/383-extract-mock_model-out-of-railsexamplegroup 
)  David extracted the mocking features for AR so that it could be  
reused easily.  I was writing a merb app that used AR and I quickly  
began missing the mock_model and other mock helpers found in rspec- 
rails.  So, I created a gem out of the plugin, installed it locally  
in my merb app I just required 'spec/rails/mocks'.



The gemspec file I created to do this was:

Gem::Specification.new do |s|
s.name = %q{rspec-rails}
s.version = "1.1.4"

s.specification_version = 2 if s.respond_to? :specification_version=

s.required_rubygems_version = Gem::Requirement.new(">= 0") if  
s.respond_to? :required_rubygems_version=

s.authors = ["RSpec Development Team"]
s.date = %q{2008-05-25}
s.default_executable = %q{spec}
s.description = %q{RSpec-Rails is an extension to RSpec to provide a  
better environment for specing rails.}

s.email = [EMAIL PROTECTED]
s.extra_rdoc_files = ["README", "CHANGES", "MIT-LICENSE"]
s.files = ["CHANGES", "MIT-LICENSE", "Rakefile", "README", "lib/ 
autotest/discover.rb", "lib/autotest/rails_rspec.rb", "lib/spec/ 
rails/example/assigns_hash_proxy.rb", "lib/spec/rails/example/ 
controller_example
_group.rb", "lib/spec/rails/example/functional_example_group.rb",  
"lib/spec/rails/example/helper_example_group.rb", "lib/spec/rails/ 
example/model_example_group.rb", "lib/spec/rails/example/ 
rails_example_group.r
b", "lib/spec/rails/example/render_observer.rb", "lib/spec/rails/ 
example/view_example_group.rb", "lib/spec/rails/example.rb", "lib/ 
spec/rails/extensions/action_controller/base.rb", "lib/spec/rails/ 
extensions/ac
tion_controller/rescue.rb", "lib/spec/rails/extensions/ 
action_controller/test_response.rb", "lib/spec/rails/extensions/ 
action_view/base.rb", "lib/spec/rails/extensions/active_record/ 
base.rb", "lib/spec/rails/ex
tensions/object.rb", "lib/spec/rails/extensions/spec/example/ 
configuration.rb", "lib/spec/rails/extensions/spec/matchers/ 
have.rb", "lib/spec/rails/extensions.rb", "lib/spec/rails/matchers/ 
assert_select.rb", "li
b/spec/rails/matchers/have_text.rb", "lib/spec/rails/matchers/ 
include_text.rb", "lib/spec/rails/matchers/redirect_to.rb", "lib/ 
spec/rails/matchers/render_template.rb", "lib/spec/rails/ 
matchers.rb", "lib/spec/ra
ils/mocks.rb", "lib/spec/rails/story_adapter.rb", "lib/spec/rails/ 
version.rb", "lib/spec/rails.rb"]

s.has_rdoc = true
s.homepage = %q{http://rspec.rubyforge.org}
s.rdoc_options = ["--title", "RSpec-Rails", "--line-numbers", "-- 
inline-source", "--main", "README"]

s.require_paths = ["lib"]
s.rubygems_version = %q{1.1.0}
s.summary = %q{RSpec-Rails-1.1.4 (build 20080526202855) - BDD for  
Ruby http://rspec.rubyforge.org/}

end



I can grab this and add it or, if you want, you can gimme a git-patch.  
Your call.


Cheers,
David
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Build rspec-rails as a gem?

2008-06-03 Thread Ben Mabey

David Chelimsky wrote:


On Jun 3, 2008, at 11:31 AM, Ben Mabey wrote:


Pat Maddox wrote:
On Mon, Jun 2, 2008 at 11:09 PM, Jose Fernandez 
<[EMAIL PROTECTED]> wrote:



I can't figure out how to build rspec-rails as a gem when just cloned
from github... there isn't any .gemspec file or rake task that does
this. Any help?



rspec-rails is a rails plugin, not a gem.

Pat
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users



I have needed to use it as a gem before.  Why?  Well, with ticket 
383(http://rspec.lighthouseapp.com/projects/5645/tickets/383-extract-mock_model-out-of-railsexamplegroup)  
David extracted the mocking features for AR so that it could be 
reused easily.  I was writing a merb app that used AR and I quickly 
began missing the mock_model and other mock helpers found in 
rspec-rails.  So, I created a gem out of the plugin, installed it 
locally in my merb app I just required 'spec/rails/mocks'.



The gemspec file I created to do this was:

Gem::Specification.new do |s|
s.name = %q{rspec-rails}
s.version = "1.1.4"

s.specification_version = 2 if s.respond_to? :specification_version=

s.required_rubygems_version = Gem::Requirement.new(">= 0") if 
s.respond_to? :required_rubygems_version=

s.authors = ["RSpec Development Team"]
s.date = %q{2008-05-25}
s.default_executable = %q{spec}
s.description = %q{RSpec-Rails is an extension to RSpec to provide a 
better environment for specing rails.}

s.email = [EMAIL PROTECTED]
s.extra_rdoc_files = ["README", "CHANGES", "MIT-LICENSE"]
s.files = ["CHANGES", "MIT-LICENSE", "Rakefile", "README", 
"lib/autotest/discover.rb", "lib/autotest/rails_rspec.rb", 
"lib/spec/rails/example/assigns_hash_proxy.rb", 
"lib/spec/rails/example/controller_example
_group.rb", "lib/spec/rails/example/functional_example_group.rb", 
"lib/spec/rails/example/helper_example_group.rb", 
"lib/spec/rails/example/model_example_group.rb", 
"lib/spec/rails/example/rails_example_group.r
b", "lib/spec/rails/example/render_observer.rb", 
"lib/spec/rails/example/view_example_group.rb", 
"lib/spec/rails/example.rb", 
"lib/spec/rails/extensions/action_controller/base.rb", 
"lib/spec/rails/extensions/ac
tion_controller/rescue.rb", 
"lib/spec/rails/extensions/action_controller/test_response.rb", 
"lib/spec/rails/extensions/action_view/base.rb", 
"lib/spec/rails/extensions/active_record/base.rb", "lib/spec/rails/ex
tensions/object.rb", 
"lib/spec/rails/extensions/spec/example/configuration.rb", 
"lib/spec/rails/extensions/spec/matchers/have.rb", 
"lib/spec/rails/extensions.rb", 
"lib/spec/rails/matchers/assert_select.rb", "li
b/spec/rails/matchers/have_text.rb", 
"lib/spec/rails/matchers/include_text.rb", 
"lib/spec/rails/matchers/redirect_to.rb", 
"lib/spec/rails/matchers/render_template.rb", 
"lib/spec/rails/matchers.rb", "lib/spec/ra
ils/mocks.rb", "lib/spec/rails/story_adapter.rb", 
"lib/spec/rails/version.rb", "lib/spec/rails.rb"]

s.has_rdoc = true
s.homepage = %q{http://rspec.rubyforge.org}
s.rdoc_options = ["--title", "RSpec-Rails", "--line-numbers", 
"--inline-source", "--main", "README"]

s.require_paths = ["lib"]
s.rubygems_version = %q{1.1.0}
s.summary = %q{RSpec-Rails-1.1.4 (build 20080526202855) - BDD for 
Ruby http://rspec.rubyforge.org/}

end



I can grab this and add it or, if you want, you can gimme a git-patch. 
Your call.




I think a rake task like rspec has would be the best solution.  I will 
create a patch and enter it on lighthouse when I get some time.


-Ben
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Build rspec-rails as a gem?

2008-06-03 Thread David Chelimsky

On Jun 3, 2008, at 11:55 AM, Ben Mabey wrote:


David Chelimsky wrote:


On Jun 3, 2008, at 11:31 AM, Ben Mabey wrote:


Pat Maddox wrote:
On Mon, Jun 2, 2008 at 11:09 PM, Jose Fernandez <[EMAIL PROTECTED] 
> wrote:


I can't figure out how to build rspec-rails as a gem when just  
cloned
from github... there isn't any .gemspec file or rake task that  
does

this. Any help?



rspec-rails is a rails plugin, not a gem.

Pat
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users



I have needed to use it as a gem before.  Why?  Well, with ticket  
383(http://rspec.lighthouseapp.com/projects/5645/tickets/383-extract-mock_model-out-of-railsexamplegroup 
)  David extracted the mocking features for AR so that it could be  
reused easily.  I was writing a merb app that used AR and I  
quickly began missing the mock_model and other mock helpers found  
in rspec-rails.  So, I created a gem out of the plugin, installed  
it locally in my merb app I just required 'spec/rails/mocks'.



The gemspec file I created to do this was:

Gem::Specification.new do |s|
s.name = %q{rspec-rails}
s.version = "1.1.4"

s.specification_version = 2 if s.respond_to? :specification_version=

s.required_rubygems_version = Gem::Requirement.new(">= 0") if  
s.respond_to? :required_rubygems_version=

s.authors = ["RSpec Development Team"]
s.date = %q{2008-05-25}
s.default_executable = %q{spec}
s.description = %q{RSpec-Rails is an extension to RSpec to provide  
a better environment for specing rails.}

s.email = [EMAIL PROTECTED]
s.extra_rdoc_files = ["README", "CHANGES", "MIT-LICENSE"]
s.files = ["CHANGES", "MIT-LICENSE", "Rakefile", "README", "lib/ 
autotest/discover.rb", "lib/autotest/rails_rspec.rb", "lib/spec/ 
rails/example/assigns_hash_proxy.rb", "lib/spec/rails/example/ 
controller_example
_group.rb", "lib/spec/rails/example/functional_example_group.rb",  
"lib/spec/rails/example/helper_example_group.rb", "lib/spec/rails/ 
example/model_example_group.rb", "lib/spec/rails/example/ 
rails_example_group.r
b", "lib/spec/rails/example/render_observer.rb", "lib/spec/rails/ 
example/view_example_group.rb", "lib/spec/rails/example.rb", "lib/ 
spec/rails/extensions/action_controller/base.rb", "lib/spec/rails/ 
extensions/ac
tion_controller/rescue.rb", "lib/spec/rails/extensions/ 
action_controller/test_response.rb", "lib/spec/rails/extensions/ 
action_view/base.rb", "lib/spec/rails/extensions/active_record/ 
base.rb", "lib/spec/rails/ex
tensions/object.rb", "lib/spec/rails/extensions/spec/example/ 
configuration.rb", "lib/spec/rails/extensions/spec/matchers/ 
have.rb", "lib/spec/rails/extensions.rb", "lib/spec/rails/matchers/ 
assert_select.rb", "li
b/spec/rails/matchers/have_text.rb", "lib/spec/rails/matchers/ 
include_text.rb", "lib/spec/rails/matchers/redirect_to.rb", "lib/ 
spec/rails/matchers/render_template.rb", "lib/spec/rails/ 
matchers.rb", "lib/spec/ra
ils/mocks.rb", "lib/spec/rails/story_adapter.rb", "lib/spec/rails/ 
version.rb", "lib/spec/rails.rb"]

s.has_rdoc = true
s.homepage = %q{http://rspec.rubyforge.org}
s.rdoc_options = ["--title", "RSpec-Rails", "--line-numbers", "-- 
inline-source", "--main", "README"]

s.require_paths = ["lib"]
s.rubygems_version = %q{1.1.0}
s.summary = %q{RSpec-Rails-1.1.4 (build 20080526202855) - BDD for  
Ruby http://rspec.rubyforge.org/}

end



I can grab this and add it or, if you want, you can gimme a git- 
patch. Your call.




I think a rake task like rspec has would be the best solution.  I  
will create a patch and enter it on lighthouse when I get some time.


Great. Thanks.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Autotest/RSpec 1.1.4/Rails 2.1 Infinite Loop?

2008-06-03 Thread rfwatson
Had this a few times - seems to be something to do with the .autotest file
in your home folder, replacing that has helped me before, but I can't be
more specific.



2008/6/3 Andrew Selder <[EMAIL PROTECTED]>:

> I just got back from RailsConf, and upgraded on of my development apps to
> 2.1, and now autotest is going into an infinite loop. It runs tests
> continuously instead of waiting for files to be saved before rerunning.
>
> Has anybody else seen this, or know how to get around it?
>
> Thanks,
>
> Andrew
>
> ___
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

[rspec-users] controller filters running twice in 1.1.4?

2008-06-03 Thread Matt McNeil

since upgrading to 1.1.4 (I had been running without issue on a git
snapshot), I'm noticing that my filter actions initiated from application.rb
seem to be running twice.  I created a test rails project with the rspec
scaffold and am also seeing the same behavior here too.

Adding this code to application.rb:

  before_filter :foo
  
  def foo
"foo"
  end
  
and an example in users_controller_spec.rb:

it "should call foo via a before filter" do
  controller.should_receive(:foo)
  do_get
end

results in this:

1)
Spec::Mocks::MockExpectationError in 'UsersController handling GET
/users.xml should call foo'
Mock 'UsersController' expected :foo with (any args) once, but received it
twice
script/spec:4:

Is any one else seeing this?

Thanks,
Matt

-- 
View this message in context: 
http://www.nabble.com/controller-filters-running-twice-in-1.1.4--tp17629653p17629653.html
Sent from the rspec-users mailing list archive at Nabble.com.

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] controller filters running twice in 1.1.4?

2008-06-03 Thread Pat Maddox
On Tue, Jun 3, 2008 at 5:31 PM, Matt McNeil <[EMAIL PROTECTED]> wrote:
>
> since upgrading to 1.1.4 (I had been running without issue on a git
> snapshot), I'm noticing that my filter actions initiated from application.rb
> seem to be running twice.  I created a test rails project with the rspec
> scaffold and am also seeing the same behavior here too.
>
> Adding this code to application.rb:
>
>  before_filter :foo
>
>  def foo
>"foo"
>  end
>
> and an example in users_controller_spec.rb:
>
>it "should call foo via a before filter" do
>  controller.should_receive(:foo)
>  do_get
>end
>
> results in this:
>
> 1)
> Spec::Mocks::MockExpectationError in 'UsersController handling GET
> /users.xml should call foo'
> Mock 'UsersController' expected :foo with (any args) once, but received it
> twice
> script/spec:4:
>
> Is any one else seeing this?

Can you put a print statement inside application.rb to see if the file
itself is being loaded multiple times?

Pat
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] controller filters running twice in 1.1.4?

2008-06-03 Thread Matt McNeil


Pat Maddox wrote:
> 
> On Tue, Jun 3, 2008 at 5:31 PM, Matt McNeil <[EMAIL PROTECTED]> wrote:
>>
>> since upgrading to 1.1.4 (I had been running without issue on a git
>> snapshot), I'm noticing that my filter actions initiated from
>> application.rb
>> seem to be running twice.  I created a test rails project with the rspec
>> scaffold and am also seeing the same behavior here too.
>>
>> Adding this code to application.rb:
>>
>>  before_filter :foo
>>
>>  def foo
>>"foo"
>>  end
>>
>> and an example in users_controller_spec.rb:
>>
>>it "should call foo via a before filter" do
>>  controller.should_receive(:foo)
>>  do_get
>>end
>>
>> results in this:
>>
>> 1)
>> Spec::Mocks::MockExpectationError in 'UsersController handling GET
>> /users.xml should call foo'
>> Mock 'UsersController' expected :foo with (any args) once, but received
>> it
>> twice
>> script/spec:4:
>>
>> Is any one else seeing this?
> 
> Can you put a print statement inside application.rb to see if the file
> itself is being loaded multiple times?
> 
> Pat
> ___
> 
> 
Hi Pat,

Yes, application.rb appears to be getting loaded twice.  Things are fine
when the before_filter is being called from the UsersController:

class UsersController < ApplicationController

  before_filter :foo

  puts "#{__FILE__} loaded " + Time.now.to_s


/opt/local/bin/ruby -S script/spec -O spec/spec.opts 
spec/controllers/users_controller_spec.rb
/Users/matt/test/app/controllers/users_controller.rb loaded Tue Jun 03
19:20:44 -0700 2008
...

Finished in 0.256665 seconds

35 examples, 0 failures

however, when that filter macro is moved to application.rb:

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time

  before_filter :foo

  puts "#{__FILE__} loaded " + Time.now.to_s

here's what happens:

/opt/local/bin/ruby -S script/spec -O spec/spec.opts 
spec/controllers/users_routing_spec.rb
spec/controllers/users_controller_spec.rb
/Users/matt/test/app/controllers/application.rb loaded Tue Jun 03 19:23:32
-0700 2008
/Users/matt/test/app/controllers/application.rb loaded Tue Jun 03 19:23:32
-0700 2008
..F.

1)
Spec::Mocks::MockExpectationError in 'UsersController handling GET
/users.xml should call foo via a before filter'
Mock 'UsersController' expected :foo with (any args) once, but received it
twice
script/spec:4:

Finished in 0.2891 seconds

48 examples, 1 failure

-- 
View this message in context: 
http://www.nabble.com/controller-filters-running-twice-in-1.1.4--tp17629653p17637883.html
Sent from the rspec-users mailing list archive at Nabble.com.

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] controller filters running twice in 1.1.4?

2008-06-03 Thread Pat Maddox
On Tue, Jun 3, 2008 at 7:27 PM, Matt McNeil <[EMAIL PROTECTED]> wrote:
>
>
> Pat Maddox wrote:
>>
>> On Tue, Jun 3, 2008 at 5:31 PM, Matt McNeil <[EMAIL PROTECTED]> wrote:
>>>
>>> since upgrading to 1.1.4 (I had been running without issue on a git
>>> snapshot), I'm noticing that my filter actions initiated from
>>> application.rb
>>> seem to be running twice.  I created a test rails project with the rspec
>>> scaffold and am also seeing the same behavior here too.
>>>
>>> Adding this code to application.rb:
>>>
>>>  before_filter :foo
>>>
>>>  def foo
>>>"foo"
>>>  end
>>>
>>> and an example in users_controller_spec.rb:
>>>
>>>it "should call foo via a before filter" do
>>>  controller.should_receive(:foo)
>>>  do_get
>>>end
>>>
>>> results in this:
>>>
>>> 1)
>>> Spec::Mocks::MockExpectationError in 'UsersController handling GET
>>> /users.xml should call foo'
>>> Mock 'UsersController' expected :foo with (any args) once, but received
>>> it
>>> twice
>>> script/spec:4:
>>>
>>> Is any one else seeing this?
>>
>> Can you put a print statement inside application.rb to see if the file
>> itself is being loaded multiple times?
>>
>> Pat
>> ___
>>
>>
> Hi Pat,
>
> Yes, application.rb appears to be getting loaded twice.  Things are fine
> when the before_filter is being called from the UsersController:
>
> class UsersController < ApplicationController
>
>  before_filter :foo
>
>  puts "#{__FILE__} loaded " + Time.now.to_s
>
>
> /opt/local/bin/ruby -S script/spec -O spec/spec.opts
> spec/controllers/users_controller_spec.rb
> /Users/matt/test/app/controllers/users_controller.rb loaded Tue Jun 03
> 19:20:44 -0700 2008
> ...
>
> Finished in 0.256665 seconds
>
> 35 examples, 0 failures
>
> however, when that filter macro is moved to application.rb:
>
> class ApplicationController < ActionController::Base
>  helper :all # include all helpers, all the time
>
>  before_filter :foo
>
>  puts "#{__FILE__} loaded " + Time.now.to_s
>
> here's what happens:
>
> /opt/local/bin/ruby -S script/spec -O spec/spec.opts
> spec/controllers/users_routing_spec.rb
> spec/controllers/users_controller_spec.rb
> /Users/matt/test/app/controllers/application.rb loaded Tue Jun 03 19:23:32
> -0700 2008
> /Users/matt/test/app/controllers/application.rb loaded Tue Jun 03 19:23:32
> -0700 2008
> ..F.
>
> 1)
> Spec::Mocks::MockExpectationError in 'UsersController handling GET
> /users.xml should call foo via a before filter'
> Mock 'UsersController' expected :foo with (any args) once, but received it
> twice
> script/spec:4:
>
> Finished in 0.2891 seconds
>
> 48 examples, 1 failure

Do you require application.rb from anywhere, but including the whole
path?  i.e. require File.join(RAILS_ROOT, "app", "controllers",
"application").  If you require the same file twice, but using two
different paths, then it'll be loaded twice.

This may happen from a plugin you've got loaded as well.

Another thing to check is the paths in your generated specs.  I
changed those a couple weeks ago, but to avoid this type of problem.
I may have screwed up, or perhaps you've got a mix of requires from
older gen'd specs and newer ones.

Pat
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] autotest only passing spec files to rspec once

2008-06-03 Thread Hans de Graaff
On Fri, 2008-04-11 at 17:16 +0200, Andy Orahood wrote:
> When I run autotest it works fine the first time, generating the command
> line:
> 
> /usr/bin/ruby1.8 -S script/spec -O spec/spec.opts
> spec/models/timespan_spec.rb spec/models/article_spec.rb ...  spec files>
> 
> and all my specs get run. After the first runthrough, however, autotest
> pauses for a second and then, without me saving any files, generates
> another command line without any of the spec files:
> 
> /usr/bin/ruby1.8 -S script/spec -O spec/spec.opts

This happens because a file got saved that did not match a pattern that
autotest can handle. It may even be your test.log. Run 'autotest -v' to
see what is really going on and add_exception in the autotest initialize
hook to avoid checking those files.

Arguably autotest shouldn't even do this empty run when it doesn't find
any matching files.

Kind regards,

Hans


signature.asc
Description: This is a digitally signed message part
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Anyone seen weird autotest behaviour on trunk?

2008-06-03 Thread Hans de Graaff
On Tue, 2008-04-01 at 08:48 +0100, Ashley Moran wrote:

> 
> Hmm, exact same revision as me.  Are we the only one s having
> problems?  I've also noticed errors along the lines of
> "ActionController not found" and "expected XXX to respond to
> respond_to?" (or something - that from the developer that sits behind
> me).

We are seeing the exact same thing with Zentest 3.9.2 and RSpec 1.1.4.
The thing I noticed yesterday is that autotest seems to want to run the
model or controller directly instead of the spec file, just like in
Ashley's original mail. Obviously this leads to an error because that
doesn't load spec_helper which in turn doesn't load the rails framework.
Presto: ActiveRecord has not been initialized.

The real question is: why is autotest running specs with the wrong
names? Did anyone resolve this yet?

Kind regards,

Hans



signature.asc
Description: This is a digitally signed message part
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users