mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-18 05:08:09 +01:00
Use RSpec 'expect' instead of 'should'
This commit is contained in:
parent
4ee8c2e7fd
commit
7a3f90a020
20 changed files with 208 additions and 248 deletions
|
|
@ -4,7 +4,7 @@ module TracksFormHelper
|
|||
edit_link = "div#line_todo_#{todo.id} a#icon_edit_todo_#{todo.id}"
|
||||
|
||||
# make sure we can open the edit form
|
||||
page.should have_css(edit_link)
|
||||
expect(page).to have_css(edit_link)
|
||||
|
||||
# on calendar page there can be more than 1 occurance of a todo, so we select the first here
|
||||
all(:css, edit_link)[0].click
|
||||
|
|
@ -17,7 +17,7 @@ module TracksFormHelper
|
|||
page.find("a#link_edit_context_#{context.id}").click
|
||||
|
||||
# wait for the form to appear (which included a submit button)
|
||||
page.should have_css("button#submit_context_#{context.id}", :visible=>true)
|
||||
expect(page).to have_css("button#submit_context_#{context.id}", :visible=>true)
|
||||
end
|
||||
|
||||
def submit_form(form_xpath, button_name)
|
||||
|
|
@ -53,23 +53,23 @@ module TracksFormHelper
|
|||
end
|
||||
|
||||
def wait_for_todo_form_to_go_away(todo)
|
||||
page.should_not have_content("button#submit_todo_#{todo.id}")
|
||||
expect(page).to_not have_content("button#submit_todo_#{todo.id}")
|
||||
end
|
||||
|
||||
def wait_for_context_form_to_appear(context)
|
||||
page.should have_css("button#submit_context_#{context.id}", :visible=>true)
|
||||
expect(page).to have_css("button#submit_context_#{context.id}", :visible=>true)
|
||||
end
|
||||
|
||||
def wait_for_context_form_to_go_away(context)
|
||||
# wait for the form to go away
|
||||
page.should_not have_css("button#submit_context_#{context.id}", :visible => true)
|
||||
expect(page).to_not have_css("button#submit_context_#{context.id}", :visible => true)
|
||||
# wait for the changed context to appear
|
||||
page.should have_css("a#link_edit_context_#{context.id}", :visible=> true)
|
||||
expect(page).to have_css("a#link_edit_context_#{context.id}", :visible=> true)
|
||||
end
|
||||
|
||||
def open_project_edit_form(project)
|
||||
click_link "link_edit_project_#{project.id}"
|
||||
page.should have_css("button#submit_project_#{project.id}")
|
||||
expect(page).to have_css("button#submit_project_#{project.id}")
|
||||
end
|
||||
|
||||
def submit_project_edit_form(project)
|
||||
|
|
@ -92,7 +92,7 @@ module TracksFormHelper
|
|||
wait_for_ajax
|
||||
wait_for_animations_to_end
|
||||
|
||||
page.should_not have_css("button#submit_project_#{project.id}", :visible => true)
|
||||
expect(page).to_not have_css("button#submit_project_#{project.id}", :visible => true)
|
||||
end
|
||||
|
||||
def edit_project_settings(project)
|
||||
|
|
|
|||
|
|
@ -29,14 +29,14 @@ module TracksStepHelper
|
|||
|
||||
def wait_for_ajax
|
||||
start_time = Time.now
|
||||
page.evaluate_script('jQuery.isReady&&jQuery.active==0').class.should_not eql(String)
|
||||
expect(page.evaluate_script('jQuery.isReady&&jQuery.active==0').class).to_not eql(String)
|
||||
until(page.evaluate_script('jQuery.isReady&&jQuery.active==0') || (start_time + 5.seconds) < Time.now)
|
||||
sleep 0.05
|
||||
end
|
||||
end
|
||||
|
||||
def wait_for_auto_complete
|
||||
page.should have_css("a.ui-state-focus", :visible => true)
|
||||
expect(page).to have_css("a.ui-state-focus", :visible => true)
|
||||
end
|
||||
|
||||
def click_first_line_of_auto_complete
|
||||
|
|
@ -57,19 +57,19 @@ module TracksStepHelper
|
|||
|
||||
def find_todo(description)
|
||||
todo = @current_user.todos.where(:description => description).first
|
||||
todo.should_not be_nil
|
||||
expect(todo).to_not be_nil
|
||||
return todo
|
||||
end
|
||||
|
||||
def find_context(context_name)
|
||||
context = @current_user.contexts.where(:name => context_name).first
|
||||
context.should_not be_nil
|
||||
expect(context).to_not be_nil
|
||||
return context
|
||||
end
|
||||
|
||||
def find_project(project_name)
|
||||
project = @current_user.projects.where(:name => project_name).first
|
||||
project.should_not be_nil
|
||||
expect(project).to_not be_nil
|
||||
return project
|
||||
end
|
||||
|
||||
|
|
@ -102,12 +102,12 @@ module TracksStepHelper
|
|||
|
||||
# click menu
|
||||
view_menu_link = "#{view_menu} a#menu_view_link"
|
||||
page.should have_css(view_menu_link, :visible => true)
|
||||
expect(page).to have_css(view_menu_link, :visible => true)
|
||||
page.find(view_menu_link).click
|
||||
|
||||
# wait for menu to be visible
|
||||
view_menu_item = "#{view_menu} li#menu_view_toggle_contexts"
|
||||
page.should have_css(view_menu_item)
|
||||
expect(page).to have_css(view_menu_item)
|
||||
|
||||
within view_menu do
|
||||
yield
|
||||
|
|
@ -118,7 +118,7 @@ module TracksStepHelper
|
|||
wait_for_animations_to_end
|
||||
|
||||
submenu_arrow = "div#line_todo_#{todo.id} img.todo-submenu"
|
||||
page.should have_css(submenu_arrow, :visible=>true)
|
||||
expect(page).to have_css(submenu_arrow, :visible=>true)
|
||||
arrow = page.find(submenu_arrow, :match => :first)
|
||||
arrow.click
|
||||
|
||||
|
|
@ -148,4 +148,4 @@ module TracksStepHelper
|
|||
page.execute_script(js)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue