Cucumber:
* Profile * Browse code * Sceleton for main features * Wiki * Commits
This commit is contained in:
parent
6ff99fe945
commit
5bbf3ccf05
37 changed files with 560 additions and 62 deletions
40
features/step_definitions/browse_code_steps.rb
Normal file
40
features/step_definitions/browse_code_steps.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
Given /^I visit project source page$/ do
|
||||
visit tree_project_ref_path(@project, @project.root_ref)
|
||||
end
|
||||
|
||||
Then /^I should see files from repository$/ do
|
||||
page.should have_content("app")
|
||||
page.should have_content("History")
|
||||
page.should have_content("Gemfile")
|
||||
end
|
||||
|
||||
Given /^I visit project source page for "(.*?)"$/ do |arg1|
|
||||
visit tree_project_ref_path(@project, arg1)
|
||||
end
|
||||
|
||||
Then /^I should see files from repository for "(.*?)"$/ do |arg1|
|
||||
current_path.should == tree_project_ref_path(@project, arg1)
|
||||
page.should have_content("app")
|
||||
page.should have_content("History")
|
||||
page.should have_content("Gemfile")
|
||||
end
|
||||
|
||||
Given /^I click on file from repo$/ do
|
||||
click_link "Gemfile"
|
||||
end
|
||||
|
||||
Then /^I should see it content$/ do
|
||||
page.should have_content("rubygems.org")
|
||||
end
|
||||
|
||||
Given /^I click on raw button$/ do
|
||||
click_link "raw"
|
||||
end
|
||||
|
||||
Given /^I visit blob file from repo$/ do
|
||||
visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
|
||||
end
|
||||
|
||||
Then /^I should see raw file content$/ do
|
||||
page.source.should == ValidCommit::BLOB_FILE
|
||||
end
|
50
features/step_definitions/commits_steps.rb
Normal file
50
features/step_definitions/commits_steps.rb
Normal file
|
@ -0,0 +1,50 @@
|
|||
Given /^I visit project commits page$/ do
|
||||
visit project_commits_path(@project)
|
||||
end
|
||||
|
||||
Then /^I see project commits$/ do
|
||||
current_path.should == project_commits_path(@project)
|
||||
|
||||
commit = @project.commit
|
||||
page.should have_content(@project.name)
|
||||
page.should have_content(commit.message)
|
||||
page.should have_content(commit.id.to_s[0..5])
|
||||
end
|
||||
|
||||
Given /^I click atom feed link$/ do
|
||||
click_link "Feed"
|
||||
end
|
||||
|
||||
Then /^I see commits atom feed$/ do
|
||||
commit = @project.commit
|
||||
page.response_headers['Content-Type'].should have_content("application/atom+xml")
|
||||
page.body.should have_selector("title", :text => "Recent commits to #{@project.name}")
|
||||
page.body.should have_selector("author email", :text => commit.author_email)
|
||||
page.body.should have_selector("entry summary", :text => commit.message)
|
||||
end
|
||||
|
||||
Given /^I click on commit link$/ do
|
||||
visit project_commit_path(@project, ValidCommit::ID)
|
||||
end
|
||||
|
||||
Then /^I see commit info$/ do
|
||||
page.should have_content ValidCommit::MESSAGE
|
||||
page.should have_content "Showing 1 changed file"
|
||||
end
|
||||
|
||||
Given /^I visit compare refs page$/ do
|
||||
visit compare_project_commits_path(@project)
|
||||
end
|
||||
|
||||
Given /^I fill compare fields with refs$/ do
|
||||
fill_in "from", :with => "master"
|
||||
fill_in "to", :with => "stable"
|
||||
click_button "Compare"
|
||||
end
|
||||
|
||||
Given /^I see compared refs$/ do
|
||||
page.should have_content "Commits (27)"
|
||||
page.should have_content "Compare View"
|
||||
page.should have_content "Showing 73 changed files"
|
||||
end
|
||||
|
38
features/step_definitions/profile_steps.rb
Normal file
38
features/step_definitions/profile_steps.rb
Normal file
|
@ -0,0 +1,38 @@
|
|||
Given /^I visit profile page$/ do
|
||||
visit profile_path
|
||||
end
|
||||
|
||||
Then /^I should see my profile info$/ do
|
||||
page.should have_content "Profile"
|
||||
page.should have_content @user.name
|
||||
page.should have_content @user.email
|
||||
end
|
||||
|
||||
Given /^I visit profile password page$/ do
|
||||
visit profile_password_path
|
||||
end
|
||||
|
||||
Then /^I change my password$/ do
|
||||
fill_in "user_password", :with => "222333"
|
||||
fill_in "user_password_confirmation", :with => "222333"
|
||||
click_button "Save"
|
||||
end
|
||||
|
||||
Then /^I should be redirected to sign in page$/ do
|
||||
current_path.should == new_user_session_path
|
||||
end
|
||||
|
||||
Given /^I visit profile token page$/ do
|
||||
visit profile_token_path
|
||||
end
|
||||
|
||||
Then /^I reset my token$/ do
|
||||
@old_token = @user.private_token
|
||||
click_button "Reset"
|
||||
end
|
||||
|
||||
Then /^I should see new token$/ do
|
||||
find("#token").value.should_not == @old_token
|
||||
find("#token").value.should == @user.reload.private_token
|
||||
end
|
||||
|
52
features/step_definitions/projects_steps.rb
Normal file
52
features/step_definitions/projects_steps.rb
Normal file
|
@ -0,0 +1,52 @@
|
|||
include LoginMacros
|
||||
|
||||
Given /^I signin as a user$/ do
|
||||
login_as :user
|
||||
end
|
||||
|
||||
When /^I visit new project page$/ do
|
||||
visit new_project_path
|
||||
end
|
||||
|
||||
When /^fill project form with valid data$/ do
|
||||
fill_in 'project_name', :with => 'NewProject'
|
||||
fill_in 'project_code', :with => 'NPR'
|
||||
fill_in 'project_path', :with => 'newproject'
|
||||
click_button "Create project"
|
||||
end
|
||||
|
||||
Then /^I should see project page$/ do
|
||||
current_path.should == project_path(Project.last)
|
||||
page.should have_content('NewProject')
|
||||
end
|
||||
|
||||
Then /^I should see empty project instuctions$/ do
|
||||
page.should have_content("git init")
|
||||
page.should have_content("git remote")
|
||||
page.should have_content(Project.last.url_to_repo)
|
||||
end
|
||||
|
||||
Given /^I own project "(.*?)"$/ do |arg1|
|
||||
@project = Factory :project, :name => arg1
|
||||
@project.add_access(@user, :read, :write)
|
||||
end
|
||||
|
||||
Given /^I visit project "(.*?)" wall page$/ do |arg1|
|
||||
project = Project.find_by_name(arg1)
|
||||
visit wall_project_path(project)
|
||||
end
|
||||
|
||||
Then /^I should see project wall note "(.*?)"$/ do |arg1|
|
||||
page.should have_content arg1
|
||||
end
|
||||
|
||||
Given /^project "(.*?)" has comment "(.*?)"$/ do |arg1, arg2|
|
||||
project = Project.find_by_name(arg1)
|
||||
project.notes.create(:note => arg1, :author => project.users.first)
|
||||
end
|
||||
|
||||
Given /^I write new comment "(.*?)"$/ do |arg1|
|
||||
fill_in "note_note", :with => arg1
|
||||
click_button "Add Comment"
|
||||
end
|
||||
|
18
features/step_definitions/wiki_steps.rb
Normal file
18
features/step_definitions/wiki_steps.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
Given /^I visit project wiki page$/ do
|
||||
visit project_wiki_path(@project, :index)
|
||||
end
|
||||
|
||||
Given /^I create Wiki page$/ do
|
||||
fill_in "Title", :with => 'Test title'
|
||||
fill_in "Content", :with => '[link test](test)'
|
||||
click_on "Save"
|
||||
end
|
||||
|
||||
Then /^I should see newly created wiki page$/ do
|
||||
page.should have_content("Test title")
|
||||
page.should have_content("link test")
|
||||
|
||||
click_link "link test"
|
||||
|
||||
page.should have_content("Editing page")
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue