Re: [rspec-users] undefined method `and_return'
thanks! had given up on this already. changing to the new syntax Image.stub!(:find, :return = @image) did get me past the error. I still can't get this spec to pass though: http://pastie.org/633580 updated spec: http://pastie.org/633584 and the controller being spec'ed: http://pastie.org/633586 2009/9/26 Borja Martín bor...@dagi3d.net: Hi, I got the same error while writing an extension for Spree and found this thread through Google. It seems it's caused by the jeremymcanally-stump[1] gem used by the application. You should use the syntax shown in the documentation http://github.com/jeremymcanally/stump Regards On Wed, Aug 26, 2009 at 1:19 AM, Oliver Barnes oli.azevedo.bar...@gmail.com wrote: Hello, I'm struggling with this controller spec for a few hours now http://pastie.org/594775 which is failing with an error I can't find any references about, neither on the list nor on the web in general: Admin::ImagesController handling PUT /images/1 with successful update should find the image requested undefined method `and_return' for #Proc:0x30520b4 /Users/oliver/Sites/spree/spec/controllers/admin/images_controller_spec.rb:17 /tmp/textmate-command-1859.rb:3 15 before(:each) do 16 �...@image = mock_model(Image, :to_param = 1) 17 Image.stub!(:find).and_return(@image) 18 end why would and_return() not be recognized, while stub!() is? has anybody experienced this problem before? I'm using rspec and rspec-rails at version 1.2.6, with Rails 2.3.2, while customizing Spree 0.8.99 thanks Oliver ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- def dagi3d(me) case me when :web then http://dagi3d.net; when :twitter then http://twitter.com/dagi3d; end end ___ 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
Re: [rspec-users] undefined method `and_return'
Hi David, I followed Borja's suggestion (message before mine). he had the same problem on a spree project, and traced it down to its use of the stump gem's helpers, which require a different syntax http://github.com/jeremymcanally/stump 2009/9/29 David Chelimsky dchelim...@gmail.com: On Mon, Sep 28, 2009 at 12:02 PM, Oliver Barnes oli.azevedo.bar...@gmail.com wrote: thanks! had given up on this already. changing to the new syntax Image.stub!(:find, :return = @image) Not sure where you got this syntax from, but it doesn't do anything. Options are: Image.stub(:find).and_return(@image) Image.stub(:find = @image) Image.stub(:find) { @image } You can also use stub! in all 3 forms. did get me past the error. I still can't get this spec to pass though: http://pastie.org/633580 updated spec: http://pastie.org/633584 and the controller being spec'ed: http://pastie.org/633586 2009/9/26 Borja Martín bor...@dagi3d.net: Hi, I got the same error while writing an extension for Spree and found this thread through Google. It seems it's caused by the jeremymcanally-stump[1] gem used by the application. You should use the syntax shown in the documentation http://github.com/jeremymcanally/stump Regards On Wed, Aug 26, 2009 at 1:19 AM, Oliver Barnes oli.azevedo.bar...@gmail.com wrote: Hello, I'm struggling with this controller spec for a few hours now http://pastie.org/594775 which is failing with an error I can't find any references about, neither on the list nor on the web in general: Admin::ImagesController handling PUT /images/1 with successful update should find the image requested undefined method `and_return' for #Proc:0x30520b4 /Users/oliver/Sites/spree/spec/controllers/admin/images_controller_spec.rb:17 /tmp/textmate-command-1859.rb:3 15 before(:each) do 16 �...@image = mock_model(Image, :to_param = 1) 17 Image.stub!(:find).and_return(@image) 18 end why would and_return() not be recognized, while stub!() is? has anybody experienced this problem before? I'm using rspec and rspec-rails at version 1.2.6, with Rails 2.3.2, while customizing Spree 0.8.99 thanks Oliver ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- def dagi3d(me) case me when :web then http://dagi3d.net; when :twitter then http://twitter.com/dagi3d; end end ___ 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 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
Re: [rspec-users] undefined method `and_return'
sorry to bother again, but no luck even after reinstalling rspec + rspec-rails: Big-Mac:spree(product-image-updates-fix) $ spec spec/controllers/admin/images_controller_spec.rb --backtrace /Users/oliver/Sites/spree/app/controllers/products_controller.rb:41: warning: parenthesize argument(s) for future version .F 1) NoMethodError in 'Admin::ImagesController handling PUT /images/1 with successful update should find the image requested' undefined method `and_return' for #Proc:0x30e1fd4 ./spec/controllers/admin/images_controller_spec.rb:17: /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:70:in `instance_eval' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:70:in `eval_each_fail_fast' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:70:in `each' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:70:in `eval_each_fail_fast' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_hierarchy.rb:17:in `run_before_each' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:103:in `run_before_each' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:124:in `before_each_example' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:39:in `execute' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:48:in `timeout' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:37:in `execute' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:207:in `run_examples' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:205:in `each' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:205:in `run_examples' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:103:in `run' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:23:in `run' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:22:in `each' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:22:in `run' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/runner/options.rb:127:in `run_examples' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/runner/command_line.rb:9:in `run' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/bin/spec:4: /usr/bin/spec:19:in `load' /usr/bin/spec:19: 2009/8/27 Oliver Barnes oli.azevedo.bar...@gmail.com: i guess it must be something wrong with my setup then? i've been messing with my gem infrastructure. going to try reinstalling rspec 2009/8/27 David Chelimsky dchelim...@gmail.com: Sorry, but no. The spec you showed in the original email should work exactly as you expect. Somehow, for reasons I don't understand, stub!() appears to be returning a Proc instead of a mock proxy object. On Thu, Aug 27, 2009 at 9:35 AM, Oliver Barnesoli.azevedo.bar...@gmail.com wrote: does that shed any light? 2009/8/26 Oliver Barnes oli.azevedo.bar...@gmail.com: sure thing: http://pastie.org/595363 2009/8/26 David Chelimsky dchelim...@gmail.com: On Tue, Aug 25, 2009 at 6:19 PM, Oliver Barnesoli.azevedo.bar...@gmail.com wrote: Hello, I'm struggling with this controller spec for a few hours now http://pastie.org/594775 which is failing with an error I can't find any references about, neither on the list nor on the web in general: Admin::ImagesController handling PUT /images/1 with successful update should find the image requested undefined method `and_return' for #Proc:0x30520b4 /Users/oliver/Sites/spree/spec/controllers/admin/images_controller_spec.rb:17 /tmp/textmate-command-1859.rb:3 15 before(:each) do 16 �...@image = mock_model(Image, :to_param = 1) 17 Image.stub!(:find).and_return(@image) 18 end why would and_return() not be recognized, while stub!() is? has anybody experienced this problem before? I'm using rspec and rspec-rails at version 1.2.6, with Rails 2.3.2, while customizing Spree 0.8.99 Please run this spec from the command line with --backtrace so we can see the full backtrace. Thanks. thanks Oliver ___ 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 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 mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec
Re: [rspec-users] undefined method `and_return'
I've done a project-wide search for stub!, and so far I haven't found a conflicting method... but i'm brain-dead right now, will look again tomorrow with fresh eyes. thanks for the response Rick 2009/8/28 Rick DeNatale rick.denat...@gmail.com: I don't usually top-post but in this case I think it works better. Is there ANY chance that Image or one of it's superclasses has defined a stub! method which would override the one in Spec::Mocks::Methods ? On Fri, Aug 28, 2009 at 6:02 PM, Oliver Barnesoli.azevedo.bar...@gmail.com wrote: sorry to bother again, but no luck even after reinstalling rspec + rspec-rails: Big-Mac:spree(product-image-updates-fix) $ spec spec/controllers/admin/images_controller_spec.rb --backtrace /Users/oliver/Sites/spree/app/controllers/products_controller.rb:41: warning: parenthesize argument(s) for future version .F 1) NoMethodError in 'Admin::ImagesController handling PUT /images/1 with successful update should find the image requested' undefined method `and_return' for #Proc:0x30e1fd4 ./spec/controllers/admin/images_controller_spec.rb:17: /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:70:in `instance_eval' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:70:in `eval_each_fail_fast' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:70:in `each' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:70:in `eval_each_fail_fast' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_hierarchy.rb:17:in `run_before_each' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:103:in `run_before_each' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:124:in `before_each_example' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:39:in `execute' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:48:in `timeout' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_methods.rb:37:in `execute' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:207:in `run_examples' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:205:in `each' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:205:in `run_examples' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/example/example_group_methods.rb:103:in `run' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:23:in `run' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:22:in `each' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/runner/example_group_runner.rb:22:in `run' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/runner/options.rb:127:in `run_examples' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/lib/spec/runner/command_line.rb:9:in `run' /Library/Ruby/Gems/1.8/gems/rspec-1.2.8/bin/spec:4: /usr/bin/spec:19:in `load' /usr/bin/spec:19: 2009/8/27 Oliver Barnes oli.azevedo.bar...@gmail.com: i guess it must be something wrong with my setup then? i've been messing with my gem infrastructure. going to try reinstalling rspec 2009/8/27 David Chelimsky dchelim...@gmail.com: Sorry, but no. The spec you showed in the original email should work exactly as you expect. Somehow, for reasons I don't understand, stub!() appears to be returning a Proc instead of a mock proxy object. On Thu, Aug 27, 2009 at 9:35 AM, Oliver Barnesoli.azevedo.bar...@gmail.com wrote: does that shed any light? 2009/8/26 Oliver Barnes oli.azevedo.bar...@gmail.com: sure thing: http://pastie.org/595363 2009/8/26 David Chelimsky dchelim...@gmail.com: On Tue, Aug 25, 2009 at 6:19 PM, Oliver Barnesoli.azevedo.bar...@gmail.com wrote: Hello, I'm struggling with this controller spec for a few hours now http://pastie.org/594775 which is failing with an error I can't find any references about, neither on the list nor on the web in general: Admin::ImagesController handling PUT /images/1 with successful update should find the image requested undefined method `and_return' for #Proc:0x30520b4 /Users/oliver/Sites/spree/spec/controllers/admin/images_controller_spec.rb:17 /tmp/textmate-command-1859.rb:3 15 before(:each) do 16 �...@image = mock_model(Image, :to_param = 1) 17 Image.stub!(:find).and_return(@image) 18 end why would and_return() not be recognized, while stub!() is? has anybody experienced this problem before? I'm using rspec and rspec-rails at version 1.2.6, with Rails 2.3.2, while customizing Spree 0.8.99 Please run this spec from the command line with --backtrace so we can see the full backtrace. Thanks. thanks Oliver ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] undefined method `and_return'
i guess it must be something wrong with my setup then? i've been messing with my gem infrastructure. going to try reinstalling rspec 2009/8/27 David Chelimsky dchelim...@gmail.com: Sorry, but no. The spec you showed in the original email should work exactly as you expect. Somehow, for reasons I don't understand, stub!() appears to be returning a Proc instead of a mock proxy object. On Thu, Aug 27, 2009 at 9:35 AM, Oliver Barnesoli.azevedo.bar...@gmail.com wrote: does that shed any light? 2009/8/26 Oliver Barnes oli.azevedo.bar...@gmail.com: sure thing: http://pastie.org/595363 2009/8/26 David Chelimsky dchelim...@gmail.com: On Tue, Aug 25, 2009 at 6:19 PM, Oliver Barnesoli.azevedo.bar...@gmail.com wrote: Hello, I'm struggling with this controller spec for a few hours now http://pastie.org/594775 which is failing with an error I can't find any references about, neither on the list nor on the web in general: Admin::ImagesController handling PUT /images/1 with successful update should find the image requested undefined method `and_return' for #Proc:0x30520b4 /Users/oliver/Sites/spree/spec/controllers/admin/images_controller_spec.rb:17 /tmp/textmate-command-1859.rb:3 15 before(:each) do 16 �...@image = mock_model(Image, :to_param = 1) 17 Image.stub!(:find).and_return(@image) 18 end why would and_return() not be recognized, while stub!() is? has anybody experienced this problem before? I'm using rspec and rspec-rails at version 1.2.6, with Rails 2.3.2, while customizing Spree 0.8.99 Please run this spec from the command line with --backtrace so we can see the full backtrace. Thanks. thanks Oliver ___ 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 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 mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] undefined method `and_return'
sure thing: http://pastie.org/595363 2009/8/26 David Chelimsky dchelim...@gmail.com: On Tue, Aug 25, 2009 at 6:19 PM, Oliver Barnesoli.azevedo.bar...@gmail.com wrote: Hello, I'm struggling with this controller spec for a few hours now http://pastie.org/594775 which is failing with an error I can't find any references about, neither on the list nor on the web in general: Admin::ImagesController handling PUT /images/1 with successful update should find the image requested undefined method `and_return' for #Proc:0x30520b4 /Users/oliver/Sites/spree/spec/controllers/admin/images_controller_spec.rb:17 /tmp/textmate-command-1859.rb:3 15 before(:each) do 16 �...@image = mock_model(Image, :to_param = 1) 17 Image.stub!(:find).and_return(@image) 18 end why would and_return() not be recognized, while stub!() is? has anybody experienced this problem before? I'm using rspec and rspec-rails at version 1.2.6, with Rails 2.3.2, while customizing Spree 0.8.99 Please run this spec from the command line with --backtrace so we can see the full backtrace. Thanks. thanks Oliver ___ 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 mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] undefined method `and_return'
Hello, I'm struggling with this controller spec for a few hours now http://pastie.org/594775 which is failing with an error I can't find any references about, neither on the list nor on the web in general: Admin::ImagesController handling PUT /images/1 with successful update should find the image requested undefined method `and_return' for #Proc:0x30520b4 /Users/oliver/Sites/spree/spec/controllers/admin/images_controller_spec.rb:17 /tmp/textmate-command-1859.rb:3 15 before(:each) do 16@image = mock_model(Image, :to_param = 1) 17Image.stub!(:find).and_return(@image) 18 end why would and_return() not be recognized, while stub!() is? has anybody experienced this problem before? I'm using rspec and rspec-rails at version 1.2.6, with Rails 2.3.2, while customizing Spree 0.8.99 thanks Oliver ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] [cucumber] more than one keyword translation
Hello, I'm trying to get Given in Portuguese to have two translations, Dado and Dada (variations on gender), so that the features are more readable. so I have this in my languages.yml: given: Dado|Dada (found this syntax in a comment within the cucumber codebase) but when I run cucumber -l pt -f progress features/ the second option isn't read: ./features/step_definitions/clipping/gerenciamento_de_clippings_steps.rb:1: undefined method `Dado' for #Object:0x389a0 (NoMethodError) from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `polyglot_original_require' from /Library/Ruby/Gems/1.8/gems/polyglot-0.2.5/lib/polyglot.rb:54:in `require' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:158:in `require' from /Library/Ruby/Gems/1.8/gems/cucumber-0.2.3/bin/../lib/cucumber/cli/main.rb:76:in `require_files' from /Library/Ruby/Gems/1.8/gems/cucumber-0.2.3/bin/../lib/cucumber/cli/main.rb:74:in `each' from /Library/Ruby/Gems/1.8/gems/cucumber-0.2.3/bin/../lib/cucumber/cli/main.rb:74:in `require_files' from /Library/Ruby/Gems/1.8/gems/cucumber-0.2.3/bin/../lib/cucumber/cli/main.rb:34:in `execute!' from /Library/Ruby/Gems/1.8/gems/cucumber-0.2.3/bin/../lib/cucumber/cli/main.rb:20:in `execute' from /Library/Ruby/Gems/1.8/gems/cucumber-0.2.3/bin/cucumber:6 from /usr/bin/cucumber:19:in `load' from /usr/bin/cucumber:19 what's the correct way to do this? - Oliver ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [cucumber] open source projects with cucumber features
I'm looking for feature examples for web apps, I imagine Balint is as well? 2009/3/11 Matt Wynne m...@mattwynne.net: On 11 Mar 2009, at 19:46, Zach Dennis wrote: On Wed, Mar 11, 2009 at 3:03 PM, Balint Erdi li...@ruby-forum.com wrote: Hi, I was looking for some real-world cucumber features (mainly on github) to see how more complex features are built but I have not really found any. Could you point me to some? What kind of app are you looking to build? Website? GUI? Console? Matt Wynne http://blog.mattwynne.net http://www.songkick.com ___ 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
Re: [rspec-users] [cucumber] open source projects with cucumber features
Rails, but any other would be helpful as well, really. Just a repo of varied real-world cucumber feature examples already would help a lot, even without the feature steps or an actual developed app. I've been mining samples from pasties, tutorials and from github, but have found only a few scattered (and several theoretical), and have not found a more evolved and cohesive set. I'm working on a real project using cucumber right now, and though I think I understand the principles shown on the rspec book and the cucumber wiki, as well as on the discussions here, at times I've gotten stuck in writing features with my client, without patterns to draw from. 2009/3/13 aslak hellesoy aslak.helle...@gmail.com: On Fri, Mar 13, 2009 at 3:22 PM, Oliver Barnes oli.azevedo.bar...@gmail.com wrote: I'm looking for feature examples for web apps, I imagine Balint is as well? What kind of webapp? Merb? JEE? Rails? Sinatra? ASP.NET? PHP? other? Aslak 2009/3/11 Matt Wynne m...@mattwynne.net: On 11 Mar 2009, at 19:46, Zach Dennis wrote: On Wed, Mar 11, 2009 at 3:03 PM, Balint Erdi li...@ruby-forum.com wrote: Hi, I was looking for some real-world cucumber features (mainly on github) to see how more complex features are built but I have not really found any. Could you point me to some? What kind of app are you looking to build? Website? GUI? Console? Matt Wynne http://blog.mattwynne.net http://www.songkick.com ___ 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 -- Aslak (::) ___ 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
Re: [rspec-users] [cucumber] open source projects with cucumber features
+1 I'm also looking for examples... I've seen several authentication-related ones, but very few examples of features that users would actually care a lot about, and that would help in learning outside-in development... 2009/3/11 Andrew Premdas aprem...@gmail.com: You could have a look at fbrp on github, which has rewritten features for RestfulAuthentication. Hopefully its a reasonably gentle introduction and at least a bit real world. 2009/3/11 Balint Erdi li...@ruby-forum.com Hi, I was looking for some real-world cucumber features (mainly on github) to see how more complex features are built but I have not really found any. Could you point me to some? Thank you, Balint -- Posted via http://www.ruby-forum.com/. ___ 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 mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Portuguese keywords not recognized
(it responds 0 Scenarios, not 0 Features, btw) 2009/2/18 Oliver Barnes oli.azevedo.bar...@gmail.com: Valeu David! muito bom poder falar com o mestre em português :) Mas eu tentei com estes, tanto com passos em inglês como em português: http://pastie.org/392962 com os passos em inglês, o cucumber simplesmente responde 0 features. com os passos em português (que eu não tenho certeza se têm suporte, estou testando just in case), ele não reconhece: ./features/step_definitions/busca_de_tese_steps.rb:1: undefined method `Dado' for #Object:0x389a0 (NoMethodError) 2009/2/17 David Chelimsky dchelim...@gmail.com: Oi Oliver, Poderia ver o codigo aqui: http://github.com/aslakhellesoy/cucumber/blob/e1afbf1908fdb3867d857478847403abeedd91d7/lib/cucumber/languages.yml HTH, David 2009/2/14 Oliver Barnes oli.azevedo.bar...@gmail.com: Hello, I've just installed cucumber 0.1.99, and it looks like the Portuguese step keywords aren't recognized for some reason. I'm following this example up on github: http://github.com/aslakhellesoy/cucumber/blob/ae9bf75d586cda232310721f62ecab91fc2336c0/examples/i18n/pt/features/adicao.feature When I switch to the original English keywords, it runs fine. I've also tried using Característica, instead of Funcionalidade for the translation of Feature, but that didn't work either. Is this a bug, or have the Portuguese keywords changed? thanks Oliver ___ 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 mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Portuguese keywords not recognized
Valeu David! muito bom poder falar com o mestre em português :) Mas eu tentei com estes, tanto com passos em inglês como em português: http://pastie.org/392962 com os passos em inglês, o cucumber simplesmente responde 0 features. com os passos em português (que eu não tenho certeza se têm suporte, estou testando just in case), ele não reconhece: ./features/step_definitions/busca_de_tese_steps.rb:1: undefined method `Dado' for #Object:0x389a0 (NoMethodError) 2009/2/17 David Chelimsky dchelim...@gmail.com: Oi Oliver, Poderia ver o codigo aqui: http://github.com/aslakhellesoy/cucumber/blob/e1afbf1908fdb3867d857478847403abeedd91d7/lib/cucumber/languages.yml HTH, David 2009/2/14 Oliver Barnes oli.azevedo.bar...@gmail.com: Hello, I've just installed cucumber 0.1.99, and it looks like the Portuguese step keywords aren't recognized for some reason. I'm following this example up on github: http://github.com/aslakhellesoy/cucumber/blob/ae9bf75d586cda232310721f62ecab91fc2336c0/examples/i18n/pt/features/adicao.feature When I switch to the original English keywords, it runs fine. I've also tried using Característica, instead of Funcionalidade for the translation of Feature, but that didn't work either. Is this a bug, or have the Portuguese keywords changed? thanks Oliver ___ 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 mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [Cucumber] Portuguese keywords not recognized
sorry to bump this up, I am the only one experiencing this problem? anybody else running cucumber in other languages? 2009/2/14 Oliver Barnes oli.azevedo.bar...@gmail.com: Hello, I've just installed cucumber 0.1.99, and it looks like the Portuguese step keywords aren't recognized for some reason. I'm following this example up on github: http://github.com/aslakhellesoy/cucumber/blob/ae9bf75d586cda232310721f62ecab91fc2336c0/examples/i18n/pt/features/adicao.feature When I switch to the original English keywords, it runs fine. I've also tried using Característica, instead of Funcionalidade for the translation of Feature, but that didn't work either. Is this a bug, or have the Portuguese keywords changed? thanks Oliver ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] tutes on testing controllers
thanks, will do - I am still wrapping my mind around mocks and stubs indeed :) 2008/3/13, Pat Maddox [EMAIL PROTECTED]: On Thu, Mar 13, 2008 at 4:55 PM, Oliver Barnes [EMAIL PROTECTED] wrote: I see. I had gotten to trying the first way you suggested (haven't tried the second yet): it should assign an image to the work do @work.should_receive(:image=).with(@image) end but I got the following error: should assign an image to the work Mock 'Work_1002' expected :image= with (#Image:0x19e8094 @name=Image_1001) once, but received it 0 times though in the actual controller @work does receive it: def create @work = @category.works.build(params[:work]) @image = Image.new(params[:image]) @work.image = @image respond_to do |format| if @image.save and @work.save flash[:notice] = 'Work was successfully created.' format.html { redirect_to admin_category_work_path(@category,@work) } else format.html { render :action = new } end end end I'm sure I'm missing something here... In all likelihood, you're not stubbing the call to @category.works.build, and instead are just letting Rails do its thing. You need to take control of the objects if you want to make interaction verifications of them. Read through some of the documentation starting at http://rspec.info/documentation/mocks/ and see if you can grok it. Feel free to ask more questions if you run into trouble. Pat ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Oliver Azevedo Barnes [EMAIL PROTECTED] +55 11 9768 0193 http://www.linkedin.com/in/oliverbarnes http://workingwithrails.com/person/4704-oliver-barnes ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] tutes on testing controllers
should have posted the code, sorry about that :) http://pastie.caboo.se/165708 I was actually posting to :create, but hadn't added do_post() to the example :P adding it solved this specific problem, thanks. hope the pastie helps another newb out 2008/3/13, Shane Mingins [EMAIL PROTECTED]: And the other thing I am not seeing you are calling create somewhere in the spec? Always a good idea to post all the code :-) Cheers Shane On 14/03/2008, at 12:55 PM, Oliver Barnes wrote: I see. I had gotten to trying the first way you suggested (haven't tried the second yet): it should assign an image to the work do @work.should_receive(:image=).with(@image) end but I got the following error: should assign an image to the work Mock 'Work_1002' expected :image= with (#Image:0x19e8094 @name=Image_1001) once, but received it 0 times though in the actual controller @work does receive it: def create @work = @category.works.build(params[:work]) @image = Image.new(params[:image]) @work.image = @image respond_to do |format| if @image.save and @work.save flash[:notice] = 'Work was successfully created.' format.html { redirect_to admin_category_work_path(@category,@work) } else format.html { render :action = new } end end end I'm sure I'm missing something here... 2008/3/13, Pat Maddox [EMAIL PROTECTED]: On Thu, Mar 13, 2008 at 3:54 PM, Oliver Barnes [EMAIL PROTECTED] wrote: thanks pat, it's still a good primer ;) I'm getting a better handle at it, but I'm still confused as to how to test assigment of associated objects. for instance, how do I test this (using attachment_fu)? @work.image = @image You could either use an interaction-based or state-based test. it should assign the work image do @mock_work.should_receive(:image=).with(@mock_image) end it should assign the work image do Work.find(3).image.should_not be_nil end The basic idea is that you're specifying that it receives a method call that you know works, or you can verify some state that should be true once the action has taken place. hth Pat ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Oliver Azevedo Barnes [EMAIL PROTECTED] +55 11 9768 0193 http://www.linkedin.com/in/oliverbarnes http://workingwithrails.com/person/4704-oliver-barnes ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users Shane Mingins ELC Technologies (TM) 1921 State Street Santa Barbara, CA 93101 Phone: +64 4 568 6684 Mobile: +64 21 435 586 Email: [EMAIL PROTECTED] AIM: ShaneMingins Skype: shane.mingins (866) 863-7365 Tel - Santa Barbara Office (866) 893-1902 Fax - Santa Barbara Office +44 020 7504 1346 Tel - London Office +44 020 7504 1347 Fax - London Office http://www.elctech.com Privacy and Confidentiality Notice: The information contained in this electronic mail message is intended for the named recipient(s) only. It may contain privileged and confidential information. If you are not an intended recipient, you must not copy, forward, distribute or take any action in reliance on it. If you have received this electronic mail message in error, please notify the sender immediately. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Oliver Azevedo Barnes [EMAIL PROTECTED] +55 11 9768 0193 http://www.linkedin.com/in/oliverbarnes http://workingwithrails.com/person/4704-oliver-barnes ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] tutes on testing controllers
thanks pat, it's still a good primer ;) I'm getting a better handle at it, but I'm still confused as to how to test assigment of associated objects. for instance, how do I test this (using attachment_fu)? @work.image = @image 2008/3/11, Pat Maddox [EMAIL PROTECTED]: On Mon, Mar 10, 2008 at 2:01 PM, Oliver Barnes [EMAIL PROTECTED] wrote: hello spec'ers, i'm in the hunt for guides on testing controllers with rspec, would you guys recommend any? Oldie but goodie (I hope) - http://evang.eli.st/blog/2007/9/15/easy-controller-tests-and-expressing-intent-through-expectations Pat ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Oliver Azevedo Barnes [EMAIL PROTECTED] +55 11 9768 0193 http://www.linkedin.com/in/oliverbarnes http://workingwithrails.com/person/4704-oliver-barnes ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] tutes on testing controllers
I see. I had gotten to trying the first way you suggested (haven't tried the second yet): it should assign an image to the work do @work.should_receive(:image=).with(@image) end but I got the following error: should assign an image to the work Mock 'Work_1002' expected :image= with (#Image:0x19e8094 @name=Image_1001) once, but received it 0 times though in the actual controller @work does receive it: def create @work = @category.works.build(params[:work]) @image = Image.new(params[:image]) @work.image = @image respond_to do |format| if @image.save and @work.save flash[:notice] = 'Work was successfully created.' format.html { redirect_to admin_category_work_path(@category,@work) } else format.html { render :action = new } end end end I'm sure I'm missing something here... 2008/3/13, Pat Maddox [EMAIL PROTECTED]: On Thu, Mar 13, 2008 at 3:54 PM, Oliver Barnes [EMAIL PROTECTED] wrote: thanks pat, it's still a good primer ;) I'm getting a better handle at it, but I'm still confused as to how to test assigment of associated objects. for instance, how do I test this (using attachment_fu)? @work.image = @image You could either use an interaction-based or state-based test. it should assign the work image do @mock_work.should_receive(:image=).with(@mock_image) end it should assign the work image do Work.find(3).image.should_not be_nil end The basic idea is that you're specifying that it receives a method call that you know works, or you can verify some state that should be true once the action has taken place. hth Pat ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users -- Oliver Azevedo Barnes [EMAIL PROTECTED] +55 11 9768 0193 http://www.linkedin.com/in/oliverbarnes http://workingwithrails.com/person/4704-oliver-barnes ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] tutes on testing controllers
hello spec'ers, i'm in the hunt for guides on testing controllers with rspec, would you guys recommend any? thanks Oliver -- Oliver Azevedo Barnes [EMAIL PROTECTED] +55 11 9768 0193 http://www.linkedin.com/in/oliverbarnes http://workingwithrails.com/person/4704-oliver-barnes ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] stuck on testing validation
Hi Namrata, thanks, that's a great resource and I ended up beefing my tests based on the recommendations there. actually though, the problem I was having was that validations weren't being recognized by the test suite. later I found out that when regenerating the scaffold for the app a while back, the database.yml used the sqlite adapter instead of mysql (I'd forgotten about this) - once I switched back to mysql, where the database was prepared, the flunking tests starting passing. :P - Oliver 2008/3/4, Namrata Tiwari [EMAIL PROTECTED]: Here is a very good example by Luke, which I think you should follow - http://www.lukeredpath.co.uk/2006/8/29/developing-a-rails-model-using-bdd-and-rspec-part-1 fyi, Namrata -- Posted via http://www.ruby-forum.com/. ___ 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] rake spec aborting
hello, when running rake spec, I'm getting a stack trace similar to the one mentioned in this ticket, which has been resolved: http://rspec.lighthouseapp.com/projects/5645/tickets/237 but from what I understood, if the project is using rspec 1.1.3 (as is the case with mine), this shouldn't be happening? here's the stack-trace: rake aborted! Command ruby -I/Users/oliver/Sites/portfolio/vendor/plugins/rspec/lib /Users/oliver/Sites/portfolio/vendor/plugins/rspec/bin/spec spec/controllers/categories_controller_spec.rb spec/controllers/categories_routing_spec.rb spec/controllers/sessions_controller_spec.rb spec/controllers/users_controller_spec.rb spec/controllers/works_controller_spec.rb spec/controllers/works_routing_spec.rb spec/helpers/categories_helper_spec.rb spec/helpers/works_helper_spec.rb spec/models/category_spec.rb spec/models/image_spec.rb spec/models/user_spec.rb spec/models/work_spec.rb spec/views/categories/edit.html.erb_spec.rb spec/views/categories/index.html.erb_spec.rb spec/views/categories/new.html.erb_spec.rb spec/views/categories/show.html.erb_spec.rb spec/views/works/edit.html.erb_spec.rb spec/views/works/index.html.erb_spec.rb spec/views/works/new.html.erb_spec.rb spec/views/works/show.html.erb_spec.rb --options /Users/oliver/Sites/portfolio/spec/spec.opts failed /Users/oliver/Sites/portfolio/vendor/plugins/rspec/lib/spec/rake/spectask.rb:184:in `define' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1003:in `verbose' /Users/oliver/Sites/portfolio/vendor/plugins/rspec/lib/spec/rake/spectask.rb:153:in `define' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `call' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `execute' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `each' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in `invoke_with_call_chain' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `synchronize' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in `top_level' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31 /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/bin/rake:19:in `load' /Applications/Locomotive2/Bundles/custom_rails2.locobundle/framework/bin/rake:19 ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] stuck on testing validation
Hello, I must be doing something dumb, but here it goes... why does this work? before(:each) do @work = Work.new end #for testing validates_presence_of :title it should require a title do @work.title = nil @work.should_not be_valid end while this doesn't: def valid_work_attributes { :title = guernica, :description = lorem ipsum lorem ipsum, :date = Date.today, :category = Category.new(:name = belle epoque) } end before(:each) do @work = Work.new end it should require a title do @work.attributes = valid_work_attributes.except(:title) @work.should_not be_valid end the latter example fails with expected valid? to return false, got true for @work.should_not be_valid doesn't make sense to me, and I've been stuck for a while already :P any help greatly appreciated, please bear with the newbie :) Oliver ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] [newbie] rspec textmate bundle problem
Hello, I've just installed the rspec textmate bundle from svn, and I'm getting the following error when I try to run a single example: /Users/oliver/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/mate.rb:2:in `require': No such file to load -- rubygems (LoadError) from /Users/oliver/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/mate.rb:2 from /tmp/temp_textmate.xVeAZb:3:in `require' from /tmp/temp_textmate.xVeAZb:3 I'm using a custom locomotive bundle with the rails 2.0.2 and rspec 1.1.3 gems installed, together with the respective rspec_on_rails plugin. I've been searching for a solution for a couple of hours, and i've tried setting both TM_RUBY and TM_RSPEC_HOME as suggested in other posts, but that didn't solve it. At one point the error changed, complaining about a missing rails 2.0.2 gem though it's installed and declared in the environment config, but I can't remember now what prompted it. appreciate any pointers with this, please bear with me as I'm new to the list and still learning my way around testing and rspec... ;) - Oliver ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] [newbie] rspec textmate bundle problem
..2 seconds after posting I found this thread from the peepcode users group http://groups.google.com/group/peepcode/browse_thread/thread/089989c61181d39c and so I set the same variables in my .bashrc, and created a new project, which got the bundle to work when opening the project from the command line. it still doesn't work from locomotive though. 2008/2/25, Oliver Barnes [EMAIL PROTECTED]: Hello, I've just installed the rspec textmate bundle from svn, and I'm getting the following error when I try to run a single example: /Users/oliver/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/mate.rb:2:in `require': No such file to load -- rubygems (LoadError) from /Users/oliver/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/mate.rb:2 from /tmp/temp_textmate.xVeAZb:3:in `require' from /tmp/temp_textmate.xVeAZb:3 I'm using a custom locomotive bundle with the rails 2.0.2 and rspec 1.1.3 gems installed, together with the respective rspec_on_rails plugin. I've been searching for a solution for a couple of hours, and i've tried setting both TM_RUBY and TM_RSPEC_HOME as suggested in other posts, but that didn't solve it. At one point the error changed, complaining about a missing rails 2.0.2 gem though it's installed and declared in the environment config, but I can't remember now what prompted it. appreciate any pointers with this, please bear with me as I'm new to the list and still learning my way around testing and rspec... ;) - Oliver ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users