Commit 5aeaf248f1730ba1698d9e98ec43920b172b9e0c
1 parent
2d5096b6
Exists in
master
and in
4 other branches
Fixing rspec after upgrade to capybara pt1
Showing
5 changed files
with
56 additions
and
34 deletions
Show diff stats
app/views/snippets/show.html.haml
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | = @snippet.title |
| 5 | 5 | %small= @snippet.file_name |
| 6 | 6 | - if can?(current_user, :admin_snippet, @project) || @snippet.author == current_user |
| 7 | - = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-small pull-right" | |
| 7 | + = link_to "Edit", edit_project_snippet_path(@project, @snippet), class: "btn btn-small pull-right", title: 'Edit Snippet' | |
| 8 | 8 | |
| 9 | 9 | %br |
| 10 | 10 | %div= render 'blob' | ... | ... |
spec/features/gitlab_flavored_markdown_spec.rb
| ... | ... | @@ -169,32 +169,40 @@ describe "Gitlab Flavored Markdown" do |
| 169 | 169 | describe "for notes" do |
| 170 | 170 | it "should render in commits#show", js: true do |
| 171 | 171 | visit project_commit_path(project, commit) |
| 172 | - fill_in "note_note", with: "see ##{issue.id}" | |
| 173 | - click_button "Add Comment" | |
| 172 | + within ".new_note.js-main-target-form" do | |
| 173 | + fill_in "note_note", with: "see ##{issue.id}" | |
| 174 | + click_button "Add Comment" | |
| 175 | + end | |
| 174 | 176 | |
| 175 | 177 | page.should have_link("##{issue.id}") |
| 176 | 178 | end |
| 177 | 179 | |
| 178 | 180 | it "should render in issue#show", js: true do |
| 179 | 181 | visit project_issue_path(project, issue) |
| 180 | - fill_in "note_note", with: "see ##{issue.id}" | |
| 181 | - click_button "Add Comment" | |
| 182 | + within ".new_note.js-main-target-form" do | |
| 183 | + fill_in "note_note", with: "see ##{issue.id}" | |
| 184 | + click_button "Add Comment" | |
| 185 | + end | |
| 182 | 186 | |
| 183 | 187 | page.should have_link("##{issue.id}") |
| 184 | 188 | end |
| 185 | 189 | |
| 186 | 190 | it "should render in merge_request#show", js: true do |
| 187 | 191 | visit project_merge_request_path(project, merge_request) |
| 188 | - fill_in "note_note", with: "see ##{issue.id}" | |
| 189 | - click_button "Add Comment" | |
| 192 | + within ".new_note.js-main-target-form" do | |
| 193 | + fill_in "note_note", with: "see ##{issue.id}" | |
| 194 | + click_button "Add Comment" | |
| 195 | + end | |
| 190 | 196 | |
| 191 | 197 | page.should have_link("##{issue.id}") |
| 192 | 198 | end |
| 193 | 199 | |
| 194 | 200 | it "should render in projects#wall", js: true do |
| 195 | 201 | visit wall_project_path(project) |
| 196 | - fill_in "note_note", with: "see ##{issue.id}" | |
| 197 | - click_button "Add Comment" | |
| 202 | + within ".new_note.js-main-target-form" do | |
| 203 | + fill_in "note_note", with: "see ##{issue.id}" | |
| 204 | + click_button "Add Comment" | |
| 205 | + end | |
| 198 | 206 | |
| 199 | 207 | page.should have_link("##{issue.id}") |
| 200 | 208 | end | ... | ... |
spec/features/snippets_spec.rb
| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | +require 'spec_helper' | |
| 2 | + | |
| 3 | +describe 'Users' do | |
| 4 | + describe "GET /users/sign_up" do | |
| 5 | + before do | |
| 6 | + Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) | |
| 7 | + end | |
| 8 | + | |
| 9 | + it "should create a new user account" do | |
| 10 | + visit new_user_registration_path | |
| 11 | + fill_in "user_name", with: "Name Surname" | |
| 12 | + fill_in "user_username", with: "Great" | |
| 13 | + fill_in "user_email", with: "name@mail.com" | |
| 14 | + fill_in "user_password", with: "password1234" | |
| 15 | + fill_in "user_password_confirmation", with: "password1234" | |
| 16 | + expect { click_button "Sign up" }.to change {User.count}.by(1) | |
| 17 | + end | |
| 18 | + end | |
| 19 | +end | ... | ... |
spec/requests/api/users_spec.rb
| ... | ... | @@ -54,32 +54,27 @@ describe Gitlab::API do |
| 54 | 54 | end |
| 55 | 55 | |
| 56 | 56 | describe "GET /users/sign_up" do |
| 57 | - before do | |
| 58 | - Gitlab.config.gitlab.stub(:signup_enabled).and_return(false) | |
| 59 | - end | |
| 60 | - it "should redirect to sign in page if signup is disabled" do | |
| 61 | - get "/users/sign_up" | |
| 62 | - response.status.should == 302 | |
| 63 | - response.should redirect_to(new_user_session_path) | |
| 64 | - end | |
| 65 | - end | |
| 57 | + context 'enabled' do | |
| 58 | + before do | |
| 59 | + Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) | |
| 60 | + end | |
| 66 | 61 | |
| 67 | - describe "GET /users/sign_up" do | |
| 68 | - before do | |
| 69 | - Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) | |
| 70 | - end | |
| 71 | - it "should return sign up page if signup is enabled" do | |
| 72 | - get "/users/sign_up" | |
| 73 | - response.status.should == 200 | |
| 62 | + it "should return sign up page if signup is enabled" do | |
| 63 | + get "/users/sign_up" | |
| 64 | + response.status.should == 200 | |
| 65 | + end | |
| 74 | 66 | end |
| 75 | - it "should create a new user account" do | |
| 76 | - visit new_user_registration_path | |
| 77 | - fill_in "user_name", with: "Name Surname" | |
| 78 | - fill_in "user_username", with: "Great" | |
| 79 | - fill_in "user_email", with: "name@mail.com" | |
| 80 | - fill_in "user_password", with: "password1234" | |
| 81 | - fill_in "user_password_confirmation", with: "password1234" | |
| 82 | - expect { click_button "Sign up" }.to change {User.count}.by(1) | |
| 67 | + | |
| 68 | + context 'disabled' do | |
| 69 | + before do | |
| 70 | + Gitlab.config.gitlab.stub(:signup_enabled).and_return(false) | |
| 71 | + end | |
| 72 | + | |
| 73 | + it "should redirect to sign in page if signup is disabled" do | |
| 74 | + get "/users/sign_up" | |
| 75 | + response.status.should == 302 | |
| 76 | + response.should redirect_to(new_user_session_path) | |
| 77 | + end | |
| 83 | 78 | end |
| 84 | 79 | end |
| 85 | 80 | ... | ... |