mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-30 12:45:18 +01:00
migrate edit update and destroy to jQuery and refactor it
test for changing state is wip, forgot to mark it with @wip
This commit is contained in:
parent
ee4ef4ad42
commit
35453acd57
12 changed files with 198 additions and 105 deletions
|
|
@ -17,7 +17,7 @@ Feature: Manage the list of projects
|
|||
When I go to the projects page
|
||||
Then I should see "manage me"
|
||||
And I should see "upgrade jquery"
|
||||
And the badge should show 2
|
||||
And the badge should show 3
|
||||
|
||||
Scenario: Clicking on a project takes me to the project page
|
||||
When I go to the projects page
|
||||
|
|
@ -27,12 +27,26 @@ Feature: Manage the list of projects
|
|||
@selenium
|
||||
Scenario: Editing a project name will update the list
|
||||
When I go to the projects page
|
||||
And I edit the project name for "manage me" to "manage him"
|
||||
And I edit the project name of "manage me" to "manage him"
|
||||
Then I should see "manage him"
|
||||
|
||||
Scenario: Dragging a project to change list order of projects
|
||||
@selenium
|
||||
Scenario: Deleting a project will remove it from the list
|
||||
When I go to the projects page
|
||||
And I delete project "manage me"
|
||||
Then I should not see "manage me"
|
||||
And the badge should show 2
|
||||
And the project list badge for "active" projects should show 2
|
||||
|
||||
@selenium
|
||||
Scenario: Changing project state will move project to other state list
|
||||
When I go to the projects page
|
||||
Then the project "manage me" should be in state list "active"
|
||||
When I edit the project state of "manage me" to "hidden"
|
||||
Then the project "manage me" should not be in state list "active"
|
||||
And the project "manage me" should be in state list "hidden"
|
||||
|
||||
Scenario: Dragging a project to change list order of projects
|
||||
Scenario: Adding a new project
|
||||
Scenario: Adding a new project and take me to the project page
|
||||
Scenario: Hiding and unhiding the new project form
|
||||
|
|
|
|||
14
features/step_definitions/project_list_steps.rb
Normal file
14
features/step_definitions/project_list_steps.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
When /^I delete project "([^"]*)"$/ do |project_name|
|
||||
# from the project list page
|
||||
project = @current_user.projects.find_by_name(project_name)
|
||||
project.should_not be_nil
|
||||
click_link "delete_project_#{project.id}"
|
||||
selenium.get_confirmation.should == "Are you sure that you want to delete the project '#{project_name}'?"
|
||||
wait_for do
|
||||
!selenium.is_element_present("delete_project_#{project.id}")
|
||||
end
|
||||
end
|
||||
|
||||
Then /^the project list badge for "([^"]*)" projects should show (\d+)$/ do |state_name, count|
|
||||
selenium.get_text("css=span##{state_name}-projects-count").should == count
|
||||
end
|
||||
|
|
@ -42,12 +42,14 @@ end
|
|||
|
||||
When /^I edit the project name to "([^\"]*)"$/ do |new_title|
|
||||
click_link "link_edit_project_#{@project.id}"
|
||||
|
||||
# no need to wait for the form because the AJAX loading should not be async!
|
||||
fill_in "project[name]", :with => new_title
|
||||
|
||||
# changed to make sure selenium waits until the saving has a result either
|
||||
# positive or negative. Was: :element=>"flash", :text=>"Project saved"
|
||||
# we may need to change it back if you really need a positive outcome, i.e.
|
||||
# this step needs to fail if the project was not saved succesfully
|
||||
# this step needs to fail if the project was not saved successfully
|
||||
selenium.click "submit_project_#{@project.id}",
|
||||
:wait_for => :text,
|
||||
:text => /(Project saved|1 error prohibited this project from being saved)/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue