devise - Rails cucumber simple test, step redirect after login_as -


I am new to the BDD approach and I am studying to write this in all my future projects.

I am trying to run a simple test in which the user must log in to access a particular page (create a new mail page) and fill out the field form before submitting.

It seems that I was able to manage the entry since the passage of examination, but when I try to access the Fair Pages, I always welcome / The index is redirected, which I do not understand. As a result, I'm unable to receive the "Failed" message in the "Next" button.

Here are my files that help you to understand my problem:

Fairs Feature: In order to make a new fair, a user must be logged in order to make a fair, proper form Fill the scenario: Make a new fair, which I have logged in as a superuser and I am on the Junk Mela page and I fill out the "Name" when I press "Create Fair" then a new object must be made with success < / Code>

create_fair_s Teps.rb (only with the problem I have):

  given (/ ^ I am logged on as superuser / user) user = build (user) login_as (User ,: scope = & gt; user: run_callbacks = & gt; false) #Warden.test_reset! Finally (/ ^ I add the appropriate page $ /) ('/ it / fairs / new') end (/ ^ "(*.?)" I press $ /). Confirm_button | #submit_form "new_fair" click_button confirm_button end  

users.rb ()

  F factory: user, category: user To use the factory "admin@email.com" password "superadmin" and end  

the factorial I have the following line env.rb file: < / P>

  World (FactoryZel :: Syntax :: Method)  

Output log

  Feature : To create a new fair, a user must be logged in, proper fo Filling M must scenario: Create a new fair # FEATURES / Fair. Feature: Looking at the transaction (0.1ms) committed transaction (0.1ms) initiated transactions (0.1ms), I'm logging super user # features / step_definitions / create_fair_steps.rb as start: 4 Start "/ it / mails / new" for 127.0.0.1 on 2014-07-31 17:50:42 +200200 by Merion processing # controller # as the new HTML parameter: {"locale" = "gt;" It "302 MMS (activated: found in 0.4 ms) redirected to http://www.example.com/it 2014-07-31 17:50:42 for" 127.0.0.1 " "Received 0200 user loads (0.6ms)" Select "those" "id" "Where" from those "Zero Command" from those "HTML IDs" as the HTML Parameters "Home ID" from the WelcomeController 1 Processing: ... {"Locale" = & gt; "This"} redirected to http://www.example.com/it/home Completed 302 found in 1 MMS (ActiveRecord: 0.0ms) received "/ it / home" for 127.0.0.1 in 2014 Went -07-31 17:50:42 +0200 WelcomeControler # indexing as HTML parameter processing: {"locale" = & gt; "This"} layout / site welcomed / index within the site (3.2ms). In 314 mms (view: 298.8 ms | ActiveRecord: 0.0ms) and I'm on the add page / features / step_definitions / create_fair_steps.rb: 10 and I fill in "name" # features / step_definitions / create_fair_steps.rb in 14: 14 I press # features "Make it right" /step_definitions/create_fair_steps.rb:18 (Capybara :: ElementNotFound) ./features/step_definitions/create_fair_steps.rb:20:in `/ ^ I press" (. *?) "Find button Unable to create "appropriate" $ / 'features / fairs.feature: 10: `When I press" Make it right "then a new fair success # features / step_definitions / create_fair_st Eps.rb should be created with: 23 (0.1ms) rollback transaction unsuccessful scenario: cucumber facilities / fairs .Feature: 6 # Scenario: Create a new fair 1 scenario (1 failed) 5 steps (1 failed, 1 skip, 3 pass )  

If you need more information please let me know any help is appreciated, thank you :)


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -