hello there, i have been trying my hand at this rbehave material, specifically in terms of integration testing a rails application, and i am curious about the most friendly way to deal with session data.
currently, the only way i have found to simulate a session is to open a session and refer to everything afterward via the @session variable stored after open_session. it seems to be workable, but is far from ideal: dir = File.dirname(__FILE__) require 'rubygems' require 'spec/story' require "#{dir}/helper" steps_for(:dealer_login) do Given("I have opened a session") do @session = open_session end Given("I am not logged in") do @session.instance_variable_get("@session").should == nil end Given("I have a valid login/password combo") do @login_with = valid_dealer_credentials end When("I submit my login/ password") do @session.post("/gateway", :user=> @login_with) end #there has to be a better way to address this Then("I should be authenticated") do @session.response.session.data.should == {:id => 1, "flash" => {}} end #and this is just hideous. Then("I should be sent to the dealer landing page") do puts @session.response.instance_variable_get("@redirected_to").should == {:controller => "dealers"} end end with_steps_for(:dealer_login) do run_local_story "dealer_story", :type=>RailsStory end there is a good chance someone has already covered this and i have just managed to miss it. documentation on rbehave is sparse (at best, as i have seen it. i have the peepcode, but if anyone has any other good resources i would be more than appreciative.) in the event that this has not been addressed, i see two possibilities: first, that i am somehow subverting the intention of rbehave. as i understand it, however, rbehave is at least partially intended for integration-level specification, so it seems to me that this session information would be valuable. on the other hand, perhaps this needs to be addressed in some way. i would be happy to help, but i am interested to see the community's opinion on the issue first. regards, evan
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users