Topic: Rspec Selenium Test cases problem.

I am testing a Ajax action using Rspec and Selenium. My story is as follows:

it "should create a new User with any input" do "/people"
@browser.wait_for_page_to_load "2000"
@browser.type "user_name", "Alok Swain" "user_submit"
@browser.text?("Alok Swain").should be_true


The action i am testing is:

def add_user

@users = User.all

render :update do |page|
  page.alert "Created User"
  page.replace_html "users", :partial => '/people/users_list', :locals => {:users => @users}


The test fails and the error I get is: 'User should create a new User with any input' FAILED expected false to be true.

This test should pass right ? I also kept an alert and tried @browser.is_alert_present.should be_true but i got the same error.

I also tried @browser.get_alert() when there should is no alert being rendered as a response. The test fails as expected.

I tried @browser.is_text_present("test") and this test succeeded. In the test database a record was created for Alok Swain but when I tried the above assertion it passed when i expected it to fail.

Is there any thing else to be done here. What am I missing ?