[rspec-users] testing against a live environment

2010-04-27 Thread Martin DeMello
I have a series of tests I want to automate, which involve running shell scripts in a live environment (i.e. nothing mocked or stubbed), and then verifying the state of the system. I thought that, even though it doesn't fit the classic definition of testing, RSpec would still be a handy way to

Re: [rspec-users] testing against a live environment

2010-04-27 Thread Matt Wynne
On 27 Apr 2010, at 10:36, Martin DeMello wrote: I have a series of tests I want to automate, which involve running shell scripts in a live environment (i.e. nothing mocked or stubbed), and then verifying the state of the system. I thought that, even though it doesn't fit the classic definition

Re: [rspec-users] Using RSpec to test Rake tests

2010-04-27 Thread David Chelimsky
On Apr 26, 2010, at 4:29 PM, John Feminella wrote: hi guys, I'm trying to be diligent about checking my `rake` tasks with RSpec tests, but in the process of feeling my way around I seem to have hit a wall. I've got a really simple RSpec test that looks like this: # ./test/meta_spec.rb

Re: [rspec-users] Using RSpec to test Rake tests

2010-04-27 Thread John Feminella
There is a general rule of thumb that says test your code, not everybody else's. This suggests that you don't really need to be testing this. Any reason you feel the need to? The specs task is generated programmatically based on several initial conditions, and eventually it will become more

Re: [rspec-users] [Cucumber:4100] Cucumber vs, RSpec

2010-04-27 Thread Pat Maddox
My other contribution to this thread is that if your code is tested primarily via Cucumber, you probably have SRP violations all over the place. That's what I've noticed in my own code, anyway. The tricky thing is that SRP violations are not necessarily crippling, particularly in Rails apps

[rspec-users] Rspec 2 and Rails 3 - missing template

2010-04-27 Thread Andrei Erdoss
Hello, I am following the example in the Rspec book, starting page 372, where a controller's create message is spec'd. it creates a new message do Message.should_receive(:new).with(text=aquickbrown fox ) post :create, :message = { text = a quick brown fox } end When i run

Re: [rspec-users] Rspec 2 and Rails 3 - missing template

2010-04-27 Thread David Chelimsky
On Apr 27, 2010, at 3:46 PM, Andrei Erdoss wrote: Hello, I am following the example in the Rspec book, starting page 372, where a controller's create message is spec'd. it creates a new message do Message.should_receive(:new).with(text=aquickbrown fox ) post

Re: [rspec-users] Rspec 2 and Rails 3 - missing template

2010-04-27 Thread David Chelimsky
On Tue, Apr 27, 2010 at 4:12 PM, David Chelimsky dchelim...@gmail.com wrote: On Tue, Apr 27, 2010 at 4:04 PM, Andrei Erdoss erd...@gmail.com wrote: Thank you for the fast response. What's the best way to handle the scenario described with Rails 3, Rspec 2? touch messages/create.html.haml :)

[rspec-users] more rspec questions

2010-04-27 Thread Patrick J. Collins
Hi everyone, I still am on my quest to understand Rspec, and I have a few new questions... If I have a complex method which calls other methods, say something like: - class Foo def complex_method setup setup_something_else mini_method1 mini_method2

Re: [rspec-users] Rspec 2 and Rails 3 - missing template

2010-04-27 Thread Andrei Erdoss
Great! Thanks. Will Rspec 2 provide isolation from view templates or is this a design change? On Tue, Apr 27, 2010 at 5:12 PM, David Chelimsky dchelim...@gmail.comwrote: On Tue, Apr 27, 2010 at 4:12 PM, David Chelimsky dchelim...@gmail.com wrote: On Tue, Apr 27, 2010 at 4:04 PM, Andrei

Re: [rspec-users] Rspec 2 and Rails 3 - missing template

2010-04-27 Thread David Chelimsky
On Tue, Apr 27, 2010 at 4:04 PM, Andrei Erdoss erd...@gmail.com wrote: Thank you for the fast response. What's the best way to handle the scenario described with Rails 3, Rspec 2? touch messages/create.html.haml :) Keep in mind that once rails 3 and rspec 2 go final, we'll have this worked

Re: [rspec-users] more rspec questions

2010-04-27 Thread Adam Sroka
On Tue, Apr 27, 2010 at 2:20 PM, Patrick J. Collins patr...@collinatorstudios.com wrote: Hi everyone, I still am on my quest to understand Rspec, and I have a few new questions... If I have a complex method which calls other methods, say something like: - class Foo  def

Re: [rspec-users] more rspec questions

2010-04-27 Thread Patrick J. Collins
Hi, What if they didn't? Is there a different way you could design this so that the interesting bits (The small methods) didn't depend so much on the other bits around them? Well this is for importing vCards... http://gist.github.com/381384 So for example, I would like to just make a spec

Re: [rspec-users] Rspec 2 and Rails 3 - missing template

2010-04-27 Thread David Chelimsky
On Apr 27, 2010, at 4:25 PM, Andrei Erdoss wrote: Great! Thanks. Will Rspec 2 provide isolation from view templates or is this a design change? There will be some sort of view isolation, but the jury is out on how it will work. I'm hopeful it will feel exactly like it does in

Re: [rspec-users] Rails 3, Rspec 2 - flash notice

2010-04-27 Thread David Chelimsky
On Apr 27, 2010, at 4:48 PM, Andrei Erdoss wrote: Hello, I also tried testing for the flash notice being set, but it's not working. it sets a flash[:notice] message do post :create flash[:notice].should == The message was saved successfully. end this is the line in the

[rspec-users] controller_name in rspec-rails2?

2010-04-27 Thread Steve
I have some specs that use controller_name because of namespaced temporary controllers in my specs. In rspec-rails2 I'm told that controller_name is not a valid method. Is there a workaround for this? Thanks, Steve ___ rspec-users mailing list

Re: [rspec-users] [Cucumber:4242] Cucumber vs, RSpec

2010-04-27 Thread Curtis Schofield
Single responsibility Principle On Tue, Apr 27, 2010 at 11:38 AM, Curtis Schofield curtis.schofi...@gmail.com wrote: Personally SRP violations are making my work hell right now on a 2 year old rails system. My first concern when re-factoring is putting test in place - there isn't much

Re: [rspec-users] [Cucumber:4242] Cucumber vs, RSpec

2010-04-27 Thread Curtis Schofield
Personally SRP violations are making my work hell right now on a 2 year old rails system. My first concern when re-factoring is putting test in place - there isn't much coverage when i started. I've been doing that for the past 2 weeks and I've found that cucumber is doing well for getting higher

[rspec-users] (LoadError) no such file to load when using rspec 2.0.0.beta.7, rails 3.0.0.beta3 and ruby 1.9.2 with RVM

2010-04-27 Thread Daniel Salmeron Amselem
I am trying to run a test for a controller with the spec command like this: spec spec/controllers/account_controller_spec.rb and this is the result: damse...@logicmail$ spec spec/controllers/accounts_controller_spec.rb /Users/damselem/.rvm/gems/ruby-1.9.2-h...@rails3/gems/rspec-

Re: [rspec-users] controller_name in rspec-rails2?

2010-04-27 Thread David Chelimsky
On Fri, Apr 23, 2010 at 10:37 AM, Steve vertebr...@gmail.com wrote: I have some specs that use controller_name because of namespaced temporary controllers in my specs. In rspec-rails2 I'm told that controller_name is not a valid method. Is there a workaround for this? Try: describe blah de

Re: [rspec-users] (LoadError) no such file to load when using rspec 2.0.0.beta.7, rails 3.0.0.beta3 and ruby 1.9.2 with RVM

2010-04-27 Thread David Chelimsky
On Apr 23, 2010, at 8:25 AM, Daniel Salmeron Amselem wrote: I am trying to run a test for a controller with the spec command like this: spec spec/controllers/account_controller_spec.rb and this is the result: damse...@logicmail$ spec spec/controllers/accounts_controller_spec.rb

Re: [rspec-users] more rspec questions

2010-04-27 Thread Adam Sroka
On Tue, Apr 27, 2010 at 2:51 PM, Patrick J. Collins patr...@collinatorstudios.com wrote: Hi, What if they didn't? Is there a different way you could design this so that the interesting bits (The small methods) didn't depend so much on the other bits around them? Well this is for importing

Re: [rspec-users] more rspec questions

2010-04-27 Thread Matt Wynne
On 27 Apr 2010, at 22:51, Patrick J. Collins wrote: Hi, What if they didn't? Is there a different way you could design this so that the interesting bits (The small methods) didn't depend so much on the other bits around them? Well this is for importing vCards...

Re: [rspec-users] more rspec questions

2010-04-27 Thread Patrick J. Collins
Also, you should directly test the implementation of the Vcard outside of this spec (i.e. in it's own spec) Could you explain what you mean by that? Patrick J. Collins http://collinatorstudios.com ___ rspec-users mailing list

Re: [rspec-users] more rspec questions

2010-04-27 Thread Patrick J. Collins
Based on the above I think the Vcard is a good opportunity for a mock. That would most likely imply that you create the Vcard somewhere else and pass it into this method. Also, you should directly test the Ok, and regarding mocking-- Something that is still very unclear to me is how can I

Re: [rspec-users] more rspec questions

2010-04-27 Thread Adam Sroka
If something in the code you are testing depends on the return value of a method then you would use a stub. e.g.: foo = mock(Foo) foo.stub!(:slave_method).and_return(foo) However, in some cases what matters is not what the method returns but the fact that slave_method gets called. i.e.:

Re: [rspec-users] more rspec questions

2010-04-27 Thread Patrick J. Collins
If something in the code you are testing depends on the return value of a method then you would use a stub. e.g.: Right, but what I am asking is--- if all of my slave methods are relying on stored card data from the @card instance variable-- how is the best way to have access to the variable

Re: [rspec-users] Rails 3, Rspec 2 - flash notice

2010-04-27 Thread Andrei Erdoss
I am using this line in my Gemfile: gem rspec-rails, :git = git:// github.com/rspec/rspec-rails.git which installs the rspec-rails-2.0.0.beta.7 I tried beta.8 but I get an error: Rspec is not missing constant Matchers! (ArgumentError) On Tue, Apr 27, 2010 at 5:59 PM, David Chelimsky

Re: [rspec-users] Rails 3, Rspec 2 - flash notice

2010-04-27 Thread David Chelimsky
On Apr 27, 2010, at 9:19 PM, Andrei Erdoss wrote: I am using this line in my Gemfile: gem rspec-rails, :git = git://github.com/rspec/rspec-rails.git which installs the rspec-rails-2.0.0.beta.7 I released beta.8 yesterday, so if you bundle install you should get the update. I just