[rspec-users] rails3: in production i get uninitialised constant rspec?

2010-09-13 Thread nathanvda
I am trying to deploy my rails3 application in a production environment. But when i run my first rake task: RAILS_ENV=production rake db:setup i always get the following result: rake aborted! uninitialized constant RSpec and then points to the line in the Rakefile where it says

Re: [rspec-users] rails3: in production i get uninitialised constant rspec?

2010-09-13 Thread nathanvda
Whoops. Found it! I have a rcov.rake inside my lib/tasks like this: desc "Run all specs with rcov" RSpec::Core::RakeTask.new("test_cov") do |t| t.rcov = true t.rcov_opts = %w{--rails --include views --exclude gems\/,spec \/,features\/,seeds\/} end Now i am looking for a clean way to disable

Re: [rspec-users] rails3: in production i get uninitialised constant rspec?

2010-09-13 Thread Justin Ko
On Sep 13, 3:58 am, nathanvda wrote: > Whoops. Found it! I have a rcov.rake inside my lib/tasks like this: > > desc  "Run all specs with rcov" > RSpec::Core::RakeTask.new("test_cov") do |t| >   t.rcov = true >   t.rcov_opts = %w{--rails --include views --exclude gems\/,spec > \/,features\/,seeds

Re: [rspec-users] rails3: in production i get uninitialised constant rspec?

2010-09-13 Thread Myron Marston
On Sep 13, 1:01 am, Justin Ko wrote: > On Sep 13, 3:58 am, nathanvda wrote: > > > > > > > Whoops. Found it! I have a rcov.rake inside my lib/tasks like this: > > > desc  "Run all specs with rcov" > > RSpec::Core::RakeTask.new("test_cov") do |t| > >   t.rcov = true > >   t.rcov_opts = %w{--rails -

[rspec-users] [Rails] Unexpected calls to *_before_type_cast in view specs

2010-09-13 Thread Jon Wood
Good evening, I'm having some issues with the view specs on a project newly upgraded from rspec-rails-1.2.x to rspec-rails-1.3.2, and also having had a Rails upgrade from 2.3.5 to 2.3.9 done at the same time. My view specs are now failing with messages like the one at the bottom of this message.

[rspec-users] [BDD] NoMethodError raised when calling #stub with incorrect parameters

2010-09-13 Thread Nicholas Henry
I'm new to RSpec and came across an interesting situation where calling a stubbed method with different parameters from those specified, raises a misleading error. Some code to illustrate: (rspec 1.3.0) describe Person do describe "#greeting" do context "using #stub with correct parameters" do

[rspec-users] rspec-rails setup in Rails 3

2010-09-13 Thread Lee Smith
I'm missing something in my setup of rspec-rails in a rails 3 project. I've included the link to the gist. It seems that it doesn't recognize rails routes for some reason...getting "undefined local variable or method". The spec file I'm running is sitting in spec/integration, if that matters. T

[rspec-users] passing a block to a stub method

2010-09-13 Thread nicolas
It seems that rspec doesn't support passing a block to a stub method. This code fails: def call_build_with_block(o) o.build do puts "hello" end end describe "call_build_with_block" do it "should call build with block" do o = double("object") o.should_receive(:build) do |&b|

[rspec-users] Incorrect wrong number of arguments exception when stubbing find

2010-09-13 Thread Michael Xavier
I'm working with a subclass of ActiveResource and I came across this oddity when trying to stub its find method. Occurring with rspec 1.3.0: The spec code looks like: [1,2].each {|id| Hive::CategoryResource.should_receive(:find).with(id).and_raise(ActiveResource::ResourceNotFound)} Hive::Category

[rspec-users] In rails 3 and rspec 2, how can I test the layout used by a call to render() ?

2010-09-13 Thread Lowell
I'm trying to test that a view was rendered with a given layout. How can I test which layout was used for the call to render() ? The call that I want to test looks like this: render :some_view, :layout => 'some_layout' Thanks! Lowell ___ rspec-users

[rspec-users] May expect { ... }.to_not be changed to expect { ... }.not_to?

2010-09-13 Thread Takumi Tsunokake
Hi, I'm Takumi Tsunokake. I think expect { ... }.not_to rails_error is more grammatical and natural than expect { ... }.to_not rails_error Are there any backgrounds and reasons of decision for expect { ... }.to_not, not expect { ... }.not_to? I'm happy if expect { ... }.to_not is changed

[rspec-users] Rspec tasks with rspec-rails 2.0

2010-09-13 Thread Kyle
After updating to Rails 3 and Rspec-rails 2.0, the tasks defined in rspec.rake do not work anymore. I instead get this, even when running the rake tasks via 'bundle exec': * You are trying to run an rspec rake task defined in * /Users/bessieandkyle/code/listsite/lib/tasks/rspec.rake, * but rsp

Re: [rspec-users] rspec-rails setup in Rails 3

2010-09-13 Thread Justin Ko
Hello, It looks like you started your integration spec with "context". Try starting it (top level) with "describe". Think of context as "setting the context for what you are describing". Let us know if that fixes it. On Sep 9, 1:46 pm, Lee Smith wrote: > I'm missing something in my setup of rsp

Re: [rspec-users] May expect { ... }.to_not be changed to expect { ... }.not_to?

2010-09-13 Thread David Chelimsky
On Sep 7, 2010, at 10:35 PM, Takumi Tsunokake wrote: > Hi, I'm Takumi Tsunokake. > > I think >expect { ... }.not_to rails_error > is more grammatical and natural than >expect { ... }.to_not rails_error I think you mean raise_error (I've made the same mistake a few times). I'm pretty sur

Re: [rspec-users] Incorrect wrong number of arguments exception when stubbing find

2010-09-13 Thread David Chelimsky
On Sep 13, 2010, at 5:30 PM, Michael Xavier wrote: > I'm working with a subclass of ActiveResource and I came across this > oddity when trying to stub its find method. Occurring with rspec > 1.3.0: > > The spec code looks like: > > [1,2].each {|id| > Hive::CategoryResource.should_receive(:find).

Re: [rspec-users] In rails 3 and rspec 2, how can I test the layout used by a call to render() ?

2010-09-13 Thread David Chelimsky
On Sep 9, 2010, at 4:52 PM, Lowell wrote: > I'm trying to test that a view was rendered with a given layout. How > can I test which layout was used for the call to render() ? > > The call that I want to test looks like this: > > render :some_view, :layout => 'some_layout' response.should rende

Re: [rspec-users] Rspec tasks with rspec-rails 2.0

2010-09-13 Thread David Chelimsky
On Sep 8, 2010, at 7:18 AM, Kyle wrote: > After updating to Rails 3 and Rspec-rails 2.0, the tasks defined in > rspec.rake Delete it. rspec-rails-2 keeps the rake tasks in a file in the gem. HTH, David > do not work anymore. I instead get this, even when running > the rake tasks via 'bundle ex

Re: [rspec-users] passing a block to a stub method

2010-09-13 Thread David Chelimsky
On Sep 13, 2010, at 5:32 PM, nicolas wrote: > It seems that rspec doesn't support passing a block to a stub method. > This code fails: > > def call_build_with_block(o) > o.build do >puts "hello" > end > end > > > describe "call_build_with_block" do > it "should call build with block" do

Re: [rspec-users] passing a block to a stub method

2010-09-13 Thread Justin Ko
On Sep 13, 6:32 pm, nicolas wrote: > It seems that rspec doesn't support passing a block to a stub method. > This code fails: > > def call_build_with_block(o) >   o.build do >     puts "hello" >   end > end > > describe "call_build_with_block" do >   it "should call build with block" do >     o =

[rspec-users] [BDD] NoMethodError raised when calling #stub with incorrect parameters

2010-09-13 Thread Nicholas Henry
I'm new to RSpec and came across an interesting situation where calling a stubbed method with different parameters from those specified, raises a misleading error. Some code to illustrate: (rspec 1.3.0) describe Person do describe "#greeting" do context "using #stub with correct parameters"

[rspec-users] [BDD] NoMethodError raised when calling #stub with incorrect parameters

2010-09-13 Thread Nicholas Henry
I'm new to RSpec and came across an interesting situation where calling a stubbed method with different parameters from those specified, raises a misleading error. Some code to illustrate: (rspec 1.3.0) describe Person do describe "#greeting" do context "using #stub with correct parameters" d

[rspec-users] Propagating settings to subtyped ExampleGroups

2010-09-13 Thread Brian Takita
Hey, rspec 2 upgrade question. Rspec 1.x had a class hierarchy. In a Rails project, the ExampleGroup inherited from Test::Unit::TestCase. That allowed me to set use_transactional_fixtures in my own ExampleGroups and rely on inheritance for the settings to propagate. Now it seems like RSpec::Core:

Re: [rspec-users] Propagating settings to subtyped ExampleGroups

2010-09-13 Thread Justin Ko
describe 'I want this to be inherited' do before do RSpec.configure {|c| c.use_transactional_fixtures = false } end context 'blah' do I would wrap it in a method if you're doing it often. On Sep 14, 12:31 am, Brian Takita wrote: > Hey, rspec 2 upgrade question. > > Rspec 1.x had a cla