I am sure it is just a configuration issue, but when I use any of the steps in the webrat_steps.rb file, I get messages like: undefined method `click_link'' I have the webrat gem installed (0.3.4). I have the aslakhellesoy-webrat (0.3.2.2) gem installed, and I have the webrat plugin installed. In my cucumber env.rb file I have the following. require ''webrat'' if !defined?(Webrat) # Comment out the next two lines if you''re not using RSpec''s matchers (should should_not) in your steps. require ''cucumber/rails/rspec'' #require ''webrat/rspec-rails'' So I am sure I have munged the setup. Any advice would be appreciated. Not withstanding, cucumber works, just not the webrat steps Best, Tom -- Posted via http://www.ruby-forum.com/.
On Wed, Jan 28, 2009 at 9:15 AM, Tom Hoen <lists at ruby-forum.com> wrote:> I am sure it is just a configuration issue, but when I use any of the > steps in the webrat_steps.rb file, I get messages like: > > undefined method `click_link'' > > I have the webrat gem installed (0.3.4). I have the aslakhellesoy-webrat > (0.3.2.2) gem installed, and I have the webrat plugin installed.I had this problem and upgraded to webrat-0.4.0 and it went away. I think that the aslakhellesoy-webrat gem was a temporary solution to incompatibilities and is out of date at this point. HTH, David> > In my cucumber env.rb file I have the following. > require ''webrat'' if !defined?(Webrat) > > # Comment out the next two lines if you''re not using RSpec''s matchers > (should should_not) in your steps. > require ''cucumber/rails/rspec'' > #require ''webrat/rspec-rails'' > > So I am sure I have munged the setup. Any advice would be appreciated. > > Not withstanding, cucumber works, just not the webrat steps > > Best, > Tom > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On 28 Jan 2009, at 15:15, Tom Hoen wrote:> I am sure it is just a configuration issue, but when I use any of the > steps in the webrat_steps.rb file, I get messages like: > > undefined method `click_link'' > > I have the webrat gem installed (0.3.4). I have the aslakhellesoy- > webrat > (0.3.2.2) gem installed, and I have the webrat plugin installed. > > In my cucumber env.rb file I have the following. > require ''webrat'' if !defined?(Webrat) > > # Comment out the next two lines if you''re not using RSpec''s matchers > (should should_not) in your steps. > require ''cucumber/rails/rspec'' > #require ''webrat/rspec-rails'' > > So I am sure I have munged the setup. Any advice would be appreciated.Hi Tom, I should update to the new version of webrat (0.4) and cucumber (can''t remember) as this stuff has gone through some churn but stabilised following that 0.4 release. Check the webrat docs, but (with that new version) I think you need to do something like Webrat.configure do |config| config.mode = :rails end You won''t need the aslakhellesoy gem anymore either I don''t think. Please let us know if you were misguided by any out-of-date documentation. Matt Wynne http://blog.mattwynne.net http://www.songkick.com
Hey Matt -> I should update to the new version of webrat (0.4) and cucumber (can''t > remember) as this stuff has gone through some churn but stabilised > following that 0.4 release. > > Check the webrat docs, but (with that new version) I think you need to > do something like > > Webrat.configure do |config| > config.mode = :rails > end > > You won''t need the aslakhellesoy gem anymore either I don''t think. > > Please let us know if you were misguided by any out-of-date > documentation. >I uninstalled the aslakhellesoy gem and installed/updated the webrat gem to 0.4 I changed the env.rb file to match the docs Now I get `load_missing_constant'': Expected /mnt/hgfs/projects/classroomparent/vendor/plugins/webrat/lib/webrat.rb to define Webrat (LoadError) Do I need to have the gem and the plugin both installed? The documentation I read was here http://wiki.github.com/aslakhellesoy/cucumber/ruby-on-rails, but it looks like it has been updated, though it doesn''t include the instructions on configuring webrat. I really appreciate your help. Tom -- Posted via http://www.ruby-forum.com/.
Appears that I did not fully remove the webrat plugin, and this was causing the problem. Thanks again for your help. -- Posted via http://www.ruby-forum.com/.
Tom Hoen wrote:> Appears that I did not fully remove the webrat plugin, and this was > causing the problem. > > Thanks again for your help.Perhaps I should request this in a new topic, but it could be another simple mistake I am making. I have the following scenario Scenario: Login Given I am using the "rpems" domain Given I am logged in as an admin user Then I should see "Classrooms" And I should see "School Year: 2008-2009" And I should see "Users" What ends up happening is after the admin login, instead of seeing the Classrooms page, the next bit of html delivered is "<html><body>You are being <a href=\"http://rpems.test/classrooms\">redirected</a>.</body></html> Is there something special I should be doing to handle redirects. After reading this (http://www.nabble.com/Cucumber,-Webrat-and-http-basic-auth-td20598510.html) my impression was that redirects are handled internally to webrat and cucumber and don''t need to be explicitly handled in the scenarios. Your thoughts are greatly appreciated. Best, Tom -- Posted via http://www.ruby-forum.com/.
On Wed, Jan 28, 2009 at 11:55 AM, Tom Hoen <lists at ruby-forum.com> wrote:> Tom Hoen wrote: >> Appears that I did not fully remove the webrat plugin, and this was >> causing the problem. >> >> Thanks again for your help. > > Perhaps I should request this in a new topic, but it could be another > simple mistake I am making. > > I have the following scenario > > Scenario: Login > Given I am using the "rpems" domain > Given I am logged in as an admin user > Then I should see "Classrooms" > And I should see "School Year: 2008-2009" > And I should see "Users" > > > What ends up happening is after the admin login, instead of seeing the > Classrooms page, the next bit of html delivered is > > "<html><body>You are being <a > href=\"http://rpems.test/classrooms\">redirected</a>.</body></html> > > Is there something special I should be doing to handle redirects. After > reading this > (http://www.nabble.com/Cucumber,-Webrat-and-http-basic-auth-td20598510.html) > my impression was that redirects are handled internally to webrat and > cucumber and don''t need to be explicitly handled in the scenarios. > > Your thoughts are greatly appreciated.There are a number of fixes for redirects and subdomain related functionality which are currently tagged for the 0.4.1 release. I had this problem after upgrading to 0.4.0, and have since updated to edge until 0.4.1 is out. http://webrat.lighthouseapp.com/projects/10503-webrat/tickets?q=redirect&filter -- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman.com
> > There are a number of fixes for redirects and subdomain related > functionality which are currently tagged for the 0.4.1 release. I had > this problem after upgrading to 0.4.0, and have since updated to edge > until 0.4.1 is out. >Thanks Zach I installed the edge code (at least I believe I have) by doing a "git clone" into the vendor/plugins/webrat folder and changing the env.rb file to no longer require the gem. However, I am still getting the error. When I attempt to login to my app, the page that is returned after successful login is <html><body>You are being <a href=\"http://rpems.test/classrooms\">redirected</a>.</body></html> instead of the contents of the redirected page. What generates this message? Is it mongrel? Rails? I just have to believe that I have something set up incorrectly. Wouldn''t everyone that is using 4.0 and has redirects in their code be facing the same problem? Any other ideas? Thanks Tom -- Posted via http://www.ruby-forum.com/.
On Wed, Jan 28, 2009 at 1:37 PM, Tom Hoen <lists at ruby-forum.com> wrote:> I installed the edge code (at least I believe I have) by doing a "git > clone" into the vendor/plugins/webrat folder and changing the env.rb > file to no longer require the gem. > > However, I am still getting the error. When I attempt to login to my > app, the page that is returned after successful login is > > <html><body>You are being <a > href=\"http://rpems.test/classrooms\">redirected</a>.</body></html> >Hey Tom, As Zack pointed out I heavily refactored the redirect logic in 0.4, but missed a few cases which will be included in 0.4.1. What repo did you clone from when you installed the plugin? Assuming it was brynary or myself then everything should be fine. If however you are still seeing problems please give me a little more context as to what URLs are being request, where they are being redirected to, etc. so that I can try and track it down. Thanks. Josh -- Josh Knowles phone: 509-979-1593 email: joshknowles at gmail.com web: http://joshknowles.com
Josh - I used "git clone git://github.com/brynary/webrat.git". Should I have used a different repo? First, I set up the host with my subdomain host! "rpems.test" Then the steps for the admin login: visit "/login" fill_in("login", :with => "admin") fill_in("password", :with => "test") click_button("Log in") Then i check what is returned, looking for the word "Classroom" to indicate that the user is on the Classrooms page. So the steps should go http://rpems.test/ http://rpems.test/login Then the Log In submit, which, if the login is successful (which it appears to be), redirects to http://rpems.test/classrooms What else could I give you to help track down the issue (if I have indeed installed the correct repo). Thanks Tom -- Posted via http://www.ruby-forum.com/.
On Wed, Jan 28, 2009 at 2:29 PM, Tom Hoen <lists at ruby-forum.com> wrote:> Josh - > > I used "git clone git://github.com/brynary/webrat.git". Should I have > used a different repo? > > First, I set up the host with my subdomain > > host! "rpems.test" > > Then the steps for the admin login: > > visit "/login" > fill_in("login", :with => "admin") > fill_in("password", :with => "test") > click_button("Log in") >Try kicking things off with: visit login_url(:host =>" rpems.test") host! is a Rails method, and outside-of the knowledge of Webrat. Webrat only knows about the URLs and paths that you actually have it go through. I think this may produce the results you want because Webrat will be aware from the get-go that you''re on as subdomain. This will probably still break in webrat HEAD, I am using this branch right now which includes a fix that is not in HEAD (it''s waiting to be merged, or for another solution to take effect): http://github.com/zdennis/webrat/tree/make_current_url_fully_qualified This ensures that webrat respects subdomains while navigating through the app. You may want to check it out until one (or al) of the following tickets are closed: http://webrat.lighthouseapp.com/projects/10503/tickets/140-current_url-should-be-fully-qualified http://webrat.lighthouseapp.com/projects/10503/tickets/147-linkabsolute_href-is-broken http://webrat.lighthouseapp.com/projects/10503/tickets/146-click_button-does-not-expand-relative-action-urls With the aforementioned branch we haven''t hit any new issues using subdomains in our app''s feature suite.> Then i check what is returned, looking for the word "Classroom" to > indicate that the user is on the Classrooms page. > > So the steps should go > http://rpems.test/ > http://rpems.test/login > > Then the Log In submit, which, if the login is successful (which it > appears to be), redirects to > http://rpems.test/classrooms > > What else could I give you to help track down the issue (if I have > indeed installed the correct repo). > > Thanks > Tom > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman.com
Zach Dennis wrote:> > This will probably still break in webrat HEAD, I am using this branch > right now which includes a fix that is not in HEAD (it''s waiting to be > merged, or for another solution to take effect): > http://github.com/zdennis/webrat/tree/make_current_url_fully_qualifiedI apologize for my newbieness to git, but i have tried several different ways of trying to checkout the code in your repo and, alas, I have failed. if I want to git clone it, what statement should I use? Thanks again for your help! -- Posted via http://www.ruby-forum.com/.
On Jan 28, 2009, at 4:49 PM, Tom Hoen wrote:> Zach Dennis wrote: > >> >> This will probably still break in webrat HEAD, I am using this branch >> right now which includes a fix that is not in HEAD (it''s waiting to >> be >> merged, or for another solution to take effect): >> http://github.com/zdennis/webrat/tree/make_current_url_fully_qualified > > > I apologize for my newbieness to git, but i have tried several > different > ways of trying to checkout the code in your repo and, alas, I have > failed. > > if I want to git clone it, what statement should I use?git clone git://github.com/zdennis/webrat.git> > > Thanks again for your help! > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
On Wed, Jan 28, 2009 at 3:57 PM, Scott Taylor <scott at railsnewbie.com> wrote:> > On Jan 28, 2009, at 4:49 PM, Tom Hoen wrote: > >> Zach Dennis wrote: >> >>> >>> This will probably still break in webrat HEAD, I am using this branch >>> right now which includes a fix that is not in HEAD (it''s waiting to be >>> merged, or for another solution to take effect): >>> http://github.com/zdennis/webrat/tree/make_current_url_fully_qualified >> >> >> I apologize for my newbieness to git, but i have tried several different >> ways of trying to checkout the code in your repo and, alas, I have >> failed. >> >> if I want to git clone it, what statement should I use? > > git clone git://github.com/zdennis/webrat.gitYou can get this if you click on the Public Clone URL: git://github.com/zdennis/webrat.git on http://github.com/zdennis/webrat/tree/make_current_url_fully_qualified> >> >> >> Thanks again for your help! >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Scott Taylor wrote:> > git clone git://github.com/zdennis/webrat.gitI am sorry to be a pain, but i get the following error. Initialize webrat/.git Initialized empty Git repository in c:/projects/pospaw/vendor/plugins/webrat/.git/ fatal: read error (Invalid argument) Tom -- Posted via http://www.ruby-forum.com/.
I was able to download the zip file and lo...the tests ran. Thanks for all your help! Tom -- Posted via http://www.ruby-forum.com/.
Hello, I recently updated rspec-rails from 1.1.12 to 1.3.0 and rspec from 1.1.12 to 1.3.0 Now while running cucumber i am facing a problem. It says as ''undefined method ''visit'''' my cucumber version is 0.3.99 and webrat version is 0.7.0. Before upgrading the gem it ran well but now above error is displayed. My env.rb file is as follows: ENV["RAILS_ENV"] ||= "test" require File.expand_path(File.dirname(__FILE__) + ''/../../config/environment'') require ''cucumber/rails/world'' # Comment out the next line if you don''t want Cucumber Unicode support require ''cucumber/formatter/unicode'' # Comment out the next line if you don''t want transactions to # open/roll back around each scenario Cucumber::Rails.use_transactional_fixtures Before do Fixtures.reset_cache fixtures_folder = File.join(RAILS_ROOT, ''spec'', ''fixtures'') fixtures = Dir[File.join(fixtures_folder, ''*.yml'')].map {|f| File.basename(f, ''.yml'') } Fixtures.create_fixtures(fixtures_folder, fixtures) end # Comment out the next line if you want Rails'' own error handling # (e.g. rescue_action_in_public / rescue_responses / rescue_from) Cucumber::Rails.bypass_rescue require ''webrat'' require ''cucumber/webrat/element_locator'' # Lets you do table.diff!(element_at(''#my_table_or_dl_or_ul_or_ol'').to_table) Webrat.configure do |config| config.mode = :rails end require ''cucumber/rails/rspec'' require ''webrat/core/matchers'' Also my config/environments/cucumber.rb contains config.cache_classes = true # This must be true for Cucumber to operate correctly! # Log error messages when you accidentally call methods on nil. config.whiny_nils = true # Show full error reports and disable caching config.action_controller.consider_all_requests_local = true config.action_controller.perform_caching = false # Disable request forgery protection in test environment config.action_controller.allow_forgery_protection = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test config.gem ''cucumber'', :lib => false, :version => ''>=0.3.99'' unless File.directory?(File.join(Rails.root, ''vendor/plugins/cucumber'')) config.gem ''webrat'', :lib => false, :version => ''>=0.7.0'' unless File.directory?(File.join(Rails.root, ''vendor/plugins/webrat'')) config.gem ''rspec'', :lib => false, :version => ''>=1.3.0'' unless File.directory?(File.join(Rails.root, ''vendor/plugins/rspec'')) config.gem ''rspec-rails'', :lib => ''spec/rails'', :version => ''>=1.3.2'' unless File.directory?(File.join(Rails.root, ''vendor/plugins/rspec-rails'')) Please suggest -- Posted via http://www.ruby-forum.com/.