diff options
Diffstat (limited to 'spec')
35 files changed, 311 insertions, 311 deletions
diff --git a/spec/api/issues_spec.rb b/spec/api/issues_spec.rb index d81a07e214b..f6d8e3792c2 100644 --- a/spec/api/issues_spec.rb +++ b/spec/api/issues_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe Gitlab::API do let(:user) { Factory :user } - let!(:project) { Factory :project, :owner => user } - let!(:issue) { Factory :issue, :author => user, :assignee => user, :project => project } + let!(:project) { Factory :project, owner: user } + let!(:issue) { Factory :issue, author: user, assignee: user, project: project } before { project.add_access(user, :read) } describe "GET /issues" do @@ -42,7 +42,7 @@ describe Gitlab::API do describe "POST /projects/:id/issues" do it "should create a new project issue" do post "#{api_prefix}/projects/#{project.code}/issues?private_token=#{user.private_token}", - :title => 'new issue', :labels => 'label, label2' + title: 'new issue', labels: 'label, label2' response.status.should == 201 json_response['title'].should == 'new issue' json_response['description'].should be_nil @@ -53,7 +53,7 @@ describe Gitlab::API do describe "PUT /projects/:id/issues/:issue_id" do it "should update a project issue" do put "#{api_prefix}/projects/#{project.code}/issues/#{issue.id}?private_token=#{user.private_token}", - :title => 'updated title', :labels => 'label2', :closed => 1 + title: 'updated title', labels: 'label2', closed: 1 response.status.should == 200 json_response['title'].should == 'updated title' json_response['labels'].should == ['label2'] diff --git a/spec/api/projects_spec.rb b/spec/api/projects_spec.rb index 2b50b6d0ec7..ff45619e58a 100644 --- a/spec/api/projects_spec.rb +++ b/spec/api/projects_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe Gitlab::API do let(:user) { Factory :user } - let!(:project) { Factory :project, :owner => user } - let!(:snippet) { Factory :snippet, :author => user, :project => project, :title => 'example' } + let!(:project) { Factory :project, owner: user } + let!(:snippet) { Factory :snippet, author: user, project: project, title: 'example' } before { project.add_access(user, :read) } describe "GET /projects" do @@ -83,7 +83,7 @@ describe Gitlab::API do describe "POST /projects/:id/snippets" do it "should create a new project snippet" do post "#{api_prefix}/projects/#{project.code}/snippets?private_token=#{user.private_token}", - :title => 'api test', :file_name => 'sample.rb', :code => 'test' + title: 'api test', file_name: 'sample.rb', code: 'test' response.status.should == 201 json_response['title'].should == 'api test' end @@ -92,7 +92,7 @@ describe Gitlab::API do describe "PUT /projects/:id/snippets" do it "should update an existing project snippet" do put "#{api_prefix}/projects/#{project.code}/snippets/#{snippet.id}?private_token=#{user.private_token}", - :code => 'updated code' + code: 'updated code' response.status.should == 200 json_response['title'].should == 'example' snippet.reload.content.should == 'updated code' diff --git a/spec/helpers/gitlab_flavored_markdown_spec.rb b/spec/helpers/gitlab_flavored_markdown_spec.rb index 15fd21804eb..e147cb39375 100644 --- a/spec/helpers/gitlab_flavored_markdown_spec.rb +++ b/spec/helpers/gitlab_flavored_markdown_spec.rb @@ -5,8 +5,8 @@ describe GitlabMarkdownHelper do @project = Project.find_by_path("gitlabhq") || Factory(:project) @commit = @project.repo.commits.first.parents.first @commit = CommitDecorator.decorate(Commit.new(@commit)) - @other_project = Factory :project, :path => "OtherPath", :code => "OtherCode" - @fake_user = Factory :user, :name => "fred" + @other_project = Factory :project, path: "OtherPath", code: "OtherCode" + @fake_user = Factory :user, name: "fred" end describe "#gfm" do @@ -18,15 +18,15 @@ describe GitlabMarkdownHelper do describe "referencing a commit" do it "should link using a full id" do - gfm("Reverts changes from #{@commit.id}").should == "Reverts changes from #{link_to @commit.id, project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "}" + gfm("Reverts changes from #{@commit.id}").should == "Reverts changes from #{link_to @commit.id, project_commit_path(@project, id: @commit.id), title: "Commit: #{@commit.author_name} - #{@commit.title}", class: "gfm gfm-commit "}" end it "should link using a short id" do - gfm("Backported from #{@commit.id[0, 6]}").should == "Backported from #{link_to @commit.id[0, 6], project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "}" + gfm("Backported from #{@commit.id[0, 6]}").should == "Backported from #{link_to @commit.id[0, 6], project_commit_path(@project, id: @commit.id), title: "Commit: #{@commit.author_name} - #{@commit.title}", class: "gfm gfm-commit "}" end it "should link with adjecent text" do - gfm("Reverted (see #{@commit.id})").should == "Reverted (see #{link_to @commit.id, project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "})" + gfm("Reverted (see #{@commit.id})").should == "Reverted (see #{link_to @commit.id, project_commit_path(@project, id: @commit.id), title: "Commit: #{@commit.author_name} - #{@commit.title}", class: "gfm gfm-commit "})" end it "should not link with an invalid id" do @@ -38,33 +38,33 @@ describe GitlabMarkdownHelper do it "should link using a simple name" do user = Factory :user, name: "barry" @project.users << user - member = @project.users_projects.where(:user_id => user).first + member = @project.users_projects.where(user_id: user).first - gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), :class => "gfm gfm-team_member "} you are right" + gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), class: "gfm gfm-team_member "} you are right" end it "should link using a name with dots" do user = Factory :user, name: "alphA.Beta" @project.users << user - member = @project.users_projects.where(:user_id => user).first + member = @project.users_projects.where(user_id: user).first - gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), :class => "gfm gfm-team_member "} you are right" + gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), class: "gfm gfm-team_member "} you are right" end it "should link using name with underscores" do user = Factory :user, name: "ping_pong_king" @project.users << user - member = @project.users_projects.where(:user_id => user).first + member = @project.users_projects.where(user_id: user).first - gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), :class => "gfm gfm-team_member "} you are right" + gfm("@#{user.name} you are right").should == "#{link_to "@#{user.name}", project_team_member_path(@project, member), class: "gfm gfm-team_member "} you are right" end it "should link with adjecent text" do - user = Factory.create(:user, :name => "ace") + user = Factory.create(:user, name: "ace") @project.users << user - member = @project.users_projects.where(:user_id => user).first + member = @project.users_projects.where(user_id: user).first - gfm("Mail the Admin (@#{user.name})").should == "Mail the Admin (#{link_to "@#{user.name}", project_team_member_path(@project, member), :class => "gfm gfm-team_member "})" + gfm("Mail the Admin (@#{user.name})").should == "Mail the Admin (#{link_to "@#{user.name}", project_team_member_path(@project, member), class: "gfm gfm-team_member "})" end it "should add styles" do @@ -80,16 +80,16 @@ describe GitlabMarkdownHelper do describe "referencing an issue" do before do - @issue = Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @project - @invalid_issue = Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @other_project + @issue = Factory :issue, assignee: @fake_user, author: @fake_user, project: @project + @invalid_issue = Factory :issue, assignee: @fake_user, author: @fake_user, project: @other_project end it "should link using a correct id" do - gfm("Fixes ##{@issue.id}").should == "Fixes #{link_to "##{@issue.id}", project_issue_path(@project, @issue), :title => "Issue: #{@issue.title}", :class => "gfm gfm-issue "}" + gfm("Fixes ##{@issue.id}").should == "Fixes #{link_to "##{@issue.id}", project_issue_path(@project, @issue), title: "Issue: #{@issue.title}", class: "gfm gfm-issue "}" end it "should link with adjecent text" do - gfm("This has already been discussed (see ##{@issue.id})").should == "This has already been discussed (see #{link_to "##{@issue.id}", project_issue_path(@project, @issue), :title => "Issue: #{@issue.title}", :class => "gfm gfm-issue "})" + gfm("This has already been discussed (see ##{@issue.id})").should == "This has already been discussed (see #{link_to "##{@issue.id}", project_issue_path(@project, @issue), title: "Issue: #{@issue.title}", class: "gfm gfm-issue "})" end it "should add styles" do @@ -103,16 +103,16 @@ describe GitlabMarkdownHelper do describe "referencing a merge request" do before do - @merge_request = Factory :merge_request, :assignee => @fake_user, :author => @fake_user, :project => @project - @invalid_merge_request = Factory :merge_request, :assignee => @fake_user, :author => @fake_user, :project => @other_project + @merge_request = Factory :merge_request, assignee: @fake_user, author: @fake_user, project: @project + @invalid_merge_request = Factory :merge_request, assignee: @fake_user, author: @fake_user, project: @other_project end it "should link using a correct id" do - gfm("Fixed in !#{@merge_request.id}").should == "Fixed in #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), :title => "Merge Request: #{@merge_request.title}", :class => "gfm gfm-merge_request "}" + gfm("Fixed in !#{@merge_request.id}").should == "Fixed in #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), title: "Merge Request: #{@merge_request.title}", class: "gfm gfm-merge_request "}" end it "should link with adjecent text" do - gfm("This has been fixed already (see !#{@merge_request.id})").should == "This has been fixed already (see #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), :title => "Merge Request: #{@merge_request.title}", :class => "gfm gfm-merge_request "})" + gfm("This has been fixed already (see !#{@merge_request.id})").should == "This has been fixed already (see #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), title: "Merge Request: #{@merge_request.title}", class: "gfm gfm-merge_request "})" end it "should add styles" do @@ -127,17 +127,17 @@ describe GitlabMarkdownHelper do describe "referencing a snippet" do before do @snippet = Factory.create(:snippet, - :title => "Render asset to string", - :author => @fake_user, - :project => @project) + title: "Render asset to string", + author: @fake_user, + project: @project) end it "should link using a correct id" do - gfm("Check out $#{@snippet.id}").should == "Check out #{link_to "$#{@snippet.id}", project_snippet_path(@project, @snippet), :title => "Snippet: #{@snippet.title}", :class => "gfm gfm-snippet "}" + gfm("Check out $#{@snippet.id}").should == "Check out #{link_to "$#{@snippet.id}", project_snippet_path(@project, @snippet), title: "Snippet: #{@snippet.title}", class: "gfm gfm-snippet "}" end it "should link with adjecent text" do - gfm("I have created a snippet for that ($#{@snippet.id})").should == "I have created a snippet for that (#{link_to "$#{@snippet.id}", project_snippet_path(@project, @snippet), :title => "Snippet: #{@snippet.title}", :class => "gfm gfm-snippet "})" + gfm("I have created a snippet for that ($#{@snippet.id})").should == "I have created a snippet for that (#{link_to "$#{@snippet.id}", project_snippet_path(@project, @snippet), title: "Snippet: #{@snippet.title}", class: "gfm gfm-snippet "})" end it "should add styles" do @@ -152,12 +152,12 @@ describe GitlabMarkdownHelper do it "should link to multiple things" do user = Factory :user, name: "barry" @project.users << user - member = @project.users_projects.where(:user_id => user).first + member = @project.users_projects.where(user_id: user).first - gfm("Let @#{user.name} fix the *mess* in #{@commit.id}").should == "Let #{link_to "@#{user.name}", project_team_member_path(@project, member), :class => "gfm gfm-team_member "} fix the *mess* in #{link_to @commit.id, project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "}" + gfm("Let @#{user.name} fix the *mess* in #{@commit.id}").should == "Let #{link_to "@#{user.name}", project_team_member_path(@project, member), class: "gfm gfm-team_member "} fix the *mess* in #{link_to @commit.id, project_commit_path(@project, id: @commit.id), title: "Commit: #{@commit.author_name} - #{@commit.title}", class: "gfm gfm-commit "}" end - it "should not trip over other stuff", :focus => true do + it "should not trip over other stuff", focus: true do gfm("_Please_ *stop* 'helping' and all the other b*$#%' you do.").should == "_Please_ *stop* 'helping' and all the other b*$#%' you do." end @@ -166,57 +166,57 @@ describe GitlabMarkdownHelper do end it "should forward HTML options to links" do - gfm("fixed in #{@commit.id}", :class => "foo").should have_selector("a.foo") + gfm("fixed in #{@commit.id}", class: "foo").should have_selector("a.foo") end end describe "#link_to_gfm" do - let(:issue1) { Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @project } - let(:issue2) { Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @project } + let(:issue1) { Factory :issue, assignee: @fake_user, author: @fake_user, project: @project } + let(:issue2) { Factory :issue, assignee: @fake_user, author: @fake_user, project: @project } it "should handle references nested in links with all the text" do - link_to_gfm("This should finally fix ##{issue1.id} and ##{issue2.id} for real", project_commit_path(@project, :id => @commit.id)).should == "#{link_to "This should finally fix ", project_commit_path(@project, :id => @commit.id)}#{link_to "##{issue1.id}", project_issue_path(@project, issue1), :title => "Issue: #{issue1.title}", :class => "gfm gfm-issue "}#{link_to " and ", project_commit_path(@project, :id => @commit.id)}#{link_to "##{issue2.id}", project_issue_path(@project, issue2), :title => "Issue: #{issue2.title}", :class => "gfm gfm-issue "}#{link_to " for real", project_commit_path(@project, :id => @commit.id)}" + link_to_gfm("This should finally fix ##{issue1.id} and ##{issue2.id} for real", project_commit_path(@project, id: @commit.id)).should == "#{link_to "This should finally fix ", project_commit_path(@project, id: @commit.id)}#{link_to "##{issue1.id}", project_issue_path(@project, issue1), title: "Issue: #{issue1.title}", class: "gfm gfm-issue "}#{link_to " and ", project_commit_path(@project, id: @commit.id)}#{link_to "##{issue2.id}", project_issue_path(@project, issue2), title: "Issue: #{issue2.title}", class: "gfm gfm-issue "}#{link_to " for real", project_commit_path(@project, id: @commit.id)}" end it "should forward HTML options" do - link_to_gfm("This should finally fix ##{issue1.id} for real", project_commit_path(@project, :id => @commit.id), :class => "foo").should have_selector(".foo") + link_to_gfm("This should finally fix ##{issue1.id} for real", project_commit_path(@project, id: @commit.id), class: "foo").should have_selector(".foo") end end describe "#markdown" do before do - @issue = Factory :issue, :assignee => @fake_user, :author => @fake_user, :project => @project - @merge_request = Factory :merge_request, :assignee => @fake_user, :author => @fake_user, :project => @project + @issue = Factory :issue, assignee: @fake_user, author: @fake_user, project: @project + @merge_request = Factory :merge_request, assignee: @fake_user, author: @fake_user, project: @project @note = Factory.create(:note, - :note => "Screenshot of the new feature", - :project => @project, - :noteable_id => @commit.id, - :noteable_type => "Commit", - :attachment => "screenshot123.jpg") + note: "Screenshot of the new feature", + project: @project, + noteable_id: @commit.id, + noteable_type: "Commit", + attachment: "screenshot123.jpg") @snippet = Factory.create(:snippet, - :title => "Render asset to string", - :author => @fake_user, - :project => @project) + title: "Render asset to string", + author: @fake_user, + project: @project) @other_user = Factory :user, name: "bill" @project.users << @other_user - @member = @project.users_projects.where(:user_id => @other_user).first + @member = @project.users_projects.where(user_id: @other_user).first end it "should handle references in paragraphs" do - markdown("\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. #{@commit.id} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.\n").should == "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. #{link_to @commit.id, project_commit_path(@project, :id => @commit.id), :title => "Commit: #{@commit.author_name} - #{@commit.title}", :class => "gfm gfm-commit "} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.</p>\n" + markdown("\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. #{@commit.id} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.\n").should == "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. #{link_to @commit.id, project_commit_path(@project, id: @commit.id), title: "Commit: #{@commit.author_name} - #{@commit.title}", class: "gfm gfm-commit "} Nam pulvinar sapien eget odio adipiscing at faucibus orci vestibulum.</p>\n" end it "should handle references in headers" do - markdown("\n# Working around ##{@issue.id} for now\n## Apply !#{@merge_request.id}").should == "<h1 id=\"toc_0\">Working around #{link_to "##{@issue.id}", project_issue_path(@project, @issue), :title => "Issue: #{@issue.title}", :class => "gfm gfm-issue "} for now</h1>\n\n<h2 id=\"toc_1\">Apply #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), :title => "Merge Request: #{@merge_request.title}", :class => "gfm gfm-merge_request "}</h2>\n" + markdown("\n# Working around ##{@issue.id} for now\n## Apply !#{@merge_request.id}").should == "<h1 id=\"toc_0\">Working around #{link_to "##{@issue.id}", project_issue_path(@project, @issue), title: "Issue: #{@issue.title}", class: "gfm gfm-issue "} for now</h1>\n\n<h2 id=\"toc_1\">Apply #{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), title: "Merge Request: #{@merge_request.title}", class: "gfm gfm-merge_request "}</h2>\n" end it "should handle references in lists" do - markdown("\n* dark: ##{@issue.id}\n* light by @#{@other_user.name}\n").should == "<ul>\n<li>dark: #{link_to "##{@issue.id}", project_issue_path(@project, @issue), :title => "Issue: #{@issue.title}", :class => "gfm gfm-issue "}</li>\n<li>light by #{link_to "@#{@other_user.name}", project_team_member_path(@project, @member), :class => "gfm gfm-team_member "}</li>\n</ul>\n" + markdown("\n* dark: ##{@issue.id}\n* light by @#{@other_user.name}\n").should == "<ul>\n<li>dark: #{link_to "##{@issue.id}", project_issue_path(@project, @issue), title: "Issue: #{@issue.title}", class: "gfm gfm-issue "}</li>\n<li>light by #{link_to "@#{@other_user.name}", project_team_member_path(@project, @member), class: "gfm gfm-team_member "}</li>\n</ul>\n" end it "should handle references in <em>" do - markdown("Apply _!#{@merge_request.id}_ ASAP").should == "<p>Apply <em>#{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), :title => "Merge Request: #{@merge_request.title}", :class => "gfm gfm-merge_request "}</em> ASAP</p>\n" + markdown("Apply _!#{@merge_request.id}_ ASAP").should == "<p>Apply <em>#{link_to "!#{@merge_request.id}", project_merge_request_path(@project, @merge_request), title: "Merge Request: #{@merge_request.title}", class: "gfm gfm-merge_request "}</em> ASAP</p>\n" end it "should leave code blocks untouched" do diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 010f063a98d..27af1e381c8 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -4,7 +4,7 @@ describe Notify do include EmailSpec::Helpers include EmailSpec::Matchers - let(:recipient) { Factory.create(:user, :email => 'recipient@example.com') } + let(:recipient) { Factory.create(:user, email: 'recipient@example.com') } let(:project) { Factory.create(:project) } shared_examples 'a multiple recipients email' do @@ -15,7 +15,7 @@ describe Notify do describe 'for new users, the email' do let(:example_site_path) { root_path } - let(:new_user) { Factory.create(:user, :email => 'newguy@example.com') } + let(:new_user) { Factory.create(:user, email: 'newguy@example.com') } subject { Notify.new_user_email(new_user.id, new_user.password) } @@ -42,8 +42,8 @@ describe Notify do context 'for a project' do describe 'items that are assignable, the email' do - let(:assignee) { Factory.create(:user, :email => 'assignee@example.com') } - let(:previous_assignee) { Factory.create(:user, :name => 'Previous Assignee') } + let(:assignee) { Factory.create(:user, email: 'assignee@example.com') } + let(:previous_assignee) { Factory.create(:user, name: 'Previous Assignee') } shared_examples 'an assignee email' do it 'is sent to the assignee' do @@ -52,7 +52,7 @@ describe Notify do end context 'for issues' do - let(:issue) { Factory.create(:issue, :assignee => assignee, :project => project ) } + let(:issue) { Factory.create(:issue, assignee: assignee, project: project ) } describe 'that are new' do subject { Notify.new_issue_email(issue.id) } @@ -94,7 +94,7 @@ describe Notify do end context 'for merge requests' do - let(:merge_request) { Factory.create(:merge_request, :assignee => assignee, :project => project) } + let(:merge_request) { Factory.create(:merge_request, assignee: assignee, project: project) } describe 'that are new' do subject { Notify.new_merge_request_email(merge_request.id) } @@ -146,8 +146,8 @@ describe Notify do end context 'items that are noteable, the email for a note' do - let(:note_author) { Factory.create(:user, :name => 'author_name') } - let(:note) { Factory.create(:note, :project => project, :author => note_author) } + let(:note_author) { Factory.create(:user, name: 'author_name') } + let(:note) { Factory.create(:note, project: project, author: note_author) } before :each do Note.stub(:find).with(note.id).and_return(note) @@ -168,7 +168,7 @@ describe Notify do end describe 'on a project wall' do - let(:note_on_the_wall_path) { wall_project_path(project, :anchor => "note_#{note.id}") } + let(:note_on_the_wall_path) { wall_project_path(project, anchor: "note_#{note.id}") } subject { Notify.note_wall_email(recipient.id, note.id) } @@ -208,8 +208,8 @@ describe Notify do end describe 'on a merge request' do - let(:merge_request) { Factory.create(:merge_request, :project => project) } - let(:note_on_merge_request_path) { project_merge_request_path(project, merge_request, :anchor => "note_#{note.id}") } + let(:merge_request) { Factory.create(:merge_request, project: project) } + let(:note_on_merge_request_path) { project_merge_request_path(project, merge_request, anchor: "note_#{note.id}") } before(:each) { note.stub(:noteable).and_return(merge_request) } subject { Notify.note_merge_request_email(recipient.id, note.id) } @@ -226,8 +226,8 @@ describe Notify do end describe 'on an issue' do - let(:issue) { Factory.create(:issue, :project => project) } - let(:note_on_issue_path) { project_issue_path(project, issue, :anchor => "note_#{note.id}") } + let(:issue) { Factory.create(:issue, project: project) } + let(:note_on_issue_path) { project_issue_path(project, issue, anchor: "note_#{note.id}") } before(:each) { note.stub(:noteable).and_return(issue) } subject { Notify.note_issue_email(recipient.id, note.id) } diff --git a/spec/models/activity_observer_spec.rb b/spec/models/activity_observer_spec.rb index aed1b26d306..0db4a9985be 100644 --- a/spec/models/activity_observer_spec.rb +++ b/spec/models/activity_observer_spec.rb @@ -11,7 +11,7 @@ describe ActivityObserver do describe "Merge Request created" do before do MergeRequest.observers.enable :activity_observer do - @merge_request = Factory :merge_request, :project => project + @merge_request = Factory :merge_request, project: project @event = Event.last end end @@ -24,7 +24,7 @@ describe ActivityObserver do describe "Issue created" do before do Issue.observers.enable :activity_observer do - @issue = Factory :issue, :project => project + @issue = Factory :issue, project: project @event = Event.last end end @@ -36,8 +36,8 @@ describe ActivityObserver do #describe "Issue commented" do #before do - #@issue = Factory :issue, :project => project - #@note = Factory :note, :noteable => @issue, :project => project + #@issue = Factory :issue, project: project + #@note = Factory :note, noteable: @issue, project: project #@event = Event.last #end diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index a295e2860cc..188f09978a7 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -45,25 +45,25 @@ describe Event do @user = project.owner data = { - :before => "0000000000000000000000000000000000000000", - :after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", - :ref => "refs/heads/master", - :user_id => @user.id, - :user_name => @user.name, - :repository => { - :name => project.name, - :url => "localhost/rubinius", - :description => "", - :homepage => "localhost/rubinius", - :private => true + before: "0000000000000000000000000000000000000000", + after: "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e", + ref: "refs/heads/master", + user_id: @user.id, + user_name: @user.name, + repository: { + name: project.name, + url: "localhost/rubinius", + description: "", + homepage: "localhost/rubinius", + private: true } } @event = Event.create( - :project => project, - :action => Event::Pushed, - :data => data, - :author_id => @user.id + project: project, + action: Event::Pushed, + data: data, + author_id: @user.id ) end diff --git a/spec/models/issue_observer_spec.rb b/spec/models/issue_observer_spec.rb index 2b9798f7e53..c6a405f1c1b 100644 --- a/spec/models/issue_observer_spec.rb +++ b/spec/models/issue_observer_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' describe IssueObserver do - let(:some_user) { double(:user, :id => 1) } - let(:assignee) { double(:user, :id => 2) } - let(:issue) { double(:issue, :id => 42, :assignee => assignee) } + let(:some_user) { double(:user, id: 1) } + let(:assignee) { double(:user, id: 2) } + let(:issue) { double(:issue, id: 42, assignee: assignee) } before(:each) { subject.stub(:current_user).and_return(some_user) } @@ -15,13 +15,13 @@ describe IssueObserver do subject.should_receive(:after_create) Issue.observers.enable :issue_observer do - Factory.create(:issue, :project => Factory.create(:project)) + Factory.create(:issue, project: Factory.create(:project)) end end it 'sends an email to the assignee' do Notify.should_receive(:new_issue_email).with(issue.id). - and_return(double(:deliver => true)) + and_return(double(deliver: true)) subject.after_create(issue) end @@ -42,7 +42,7 @@ describe IssueObserver do end it 'is called when an issue is changed' do - changed = Factory.create(:issue, :project => Factory.create(:project)) + changed = Factory.create(:issue, project: Factory.create(:project)) subject.should_receive(:after_update) Issue.observers.enable :issue_observer do @@ -101,7 +101,7 @@ describe IssueObserver do end describe '#send_reassigned_email' do - let(:previous_assignee) { double(:user, :id => 3) } + let(:previous_assignee) { double(:user, id: 3) } before(:each) do issue.stub(:assignee_id).and_return(assignee.id) @@ -110,7 +110,7 @@ describe IssueObserver do def it_sends_a_reassigned_email_to(recipient) Notify.should_receive(:reassigned_issue_email).with(recipient, issue.id, previous_assignee.id). - and_return(double(:deliver => true)) + and_return(double(deliver: true)) end def it_does_not_send_a_reassigned_email_to(recipient) diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 806b8ee74e0..e9cbd72589a 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -20,9 +20,9 @@ describe Issue do end subject { Factory.create(:issue, - :author => Factory(:user), - :assignee => Factory(:user), - :project => Factory.create(:project)) } + author: Factory(:user), + assignee: Factory(:user), + project: Factory.create(:project)) } it { should be_valid } describe '#is_being_reassigned?' do @@ -42,10 +42,10 @@ describe Issue do end it 'returns false if the closed attribute has changed and is now false' do issue = Factory.create(:issue, - :closed => true, - :author => Factory(:user), - :assignee => Factory(:user), - :project => Factory.create(:project)) + closed: true, + author: Factory(:user), + assignee: Factory(:user), + project: Factory.create(:project)) issue.closed = false issue.is_being_closed?.should be_false end @@ -58,10 +58,10 @@ describe Issue do describe '#is_being_reopened?' do it 'returns true if the closed attribute has changed and is now false' do issue = Factory.create(:issue, - :closed => true, - :author => Factory(:user), - :assignee => Factory(:user), - :project => Factory.create(:project)) + closed: true, + author: Factory(:user), + assignee: Factory(:user), + project: Factory.create(:project)) issue.closed = false issue.is_being_reopened?.should be_true end @@ -78,9 +78,9 @@ describe Issue do let(:project) { Factory(:project) } subject { Factory.create(:issue, - :author => Factory(:user), - :assignee => Factory(:user), - :project => project) + author: Factory(:user), + assignee: Factory(:user), + project: project) } it "with no notes has a 0/0 score" do @@ -107,8 +107,8 @@ describe Issue do end describe ".search" do - let!(:issue) { Factory.create(:issue, :title => "Searchable issue", - :project => Factory.create(:project)) } + let!(:issue) { Factory.create(:issue, title: "Searchable issue", + project: Factory.create(:project)) } it "matches by title" do Issue.search('able').all.should == [issue] diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 4ef6becf41b..c7ad08a1e06 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -21,17 +21,17 @@ describe MergeRequest do end it { Factory.create(:merge_request, - :author => Factory(:user), - :assignee => Factory(:user), - :project => Factory.create(:project)).should be_valid } + author: Factory(:user), + assignee: Factory(:user), + project: Factory.create(:project)).should be_valid } describe "plus 1" do let(:project) { Factory(:project) } subject { Factory.create(:merge_request, - :author => Factory(:user), - :assignee => Factory(:user), - :project => project) + author: Factory(:user), + assignee: Factory(:user), + project: project) } it "with no notes has a 0/0 score" do @@ -58,8 +58,8 @@ describe MergeRequest do end describe ".search" do - let!(:issue) { Factory.create(:issue, :title => "Searchable issue", - :project => Factory.create(:project)) } + let!(:issue) { Factory.create(:issue, title: "Searchable issue", + project: Factory.create(:project)) } it "matches by title" do Issue.search('able').all.should == [issue] diff --git a/spec/models/milestone_spec.rb b/spec/models/milestone_spec.rb index bb71ca990f0..880d3f307a3 100644 --- a/spec/models/milestone_spec.rb +++ b/spec/models/milestone_spec.rb @@ -26,8 +26,8 @@ describe Milestone do end let(:project) { Factory :project } - let(:milestone) { Factory :milestone, :project => project } - let(:issue) { Factory :issue, :project => project } + let(:milestone) { Factory :milestone, project: project } + let(:issue) { Factory :issue, project: project } it { milestone.should be_valid } @@ -39,14 +39,14 @@ describe Milestone do it { milestone.percent_complete.should == 0 } it do - issue.update_attributes :closed => true + issue.update_attributes closed: true milestone.percent_complete.should == 100 end end describe :expires_at do before do - milestone.update_attributes :due_date => Date.today + 1.day + milestone.update_attributes due_date: Date.today + 1.day end it { milestone.expires_at.should_not be_nil } diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index f2dfcabcc87..c97b23cb4fa 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -14,7 +14,7 @@ describe Note do end it { Factory.create(:note, - :project => project).should be_valid } + project: project).should be_valid } describe "Scopes" do it "should have a today named scope that returns ..." do Note.today.where_values.should == ["created_at >= '#{Date.today}'"] @@ -44,9 +44,9 @@ describe Note do before do @note = Factory :note, - :project => project, - :noteable_id => commit.id, - :noteable_type => "Commit" + project: project, + noteable_id: commit.id, + noteable_type: "Commit" end it "should save a valid note" do @@ -58,10 +58,10 @@ describe Note do describe "Pre-line commit notes" do before do @note = Factory :note, - :project => project, - :noteable_id => commit.id, - :noteable_type => "Commit", - :line_code => "0_16_1" + project: project, + noteable_id: commit.id, + noteable_type: "Commit", + line_code: "0_16_1" end it "should save a valid note" do @@ -72,7 +72,7 @@ describe Note do describe '#create_status_change_note' do let(:project) { Factory.create(:project) } - let(:thing) { Factory.create(:issue, :project => project) } + let(:thing) { Factory.create(:issue, project: project) } let(:author) { Factory(:user) } let(:status) { 'new_status' } @@ -92,7 +92,7 @@ describe Note do describe :authorization do before do @p1 = project - @p2 = Factory :project, :code => "alien", :path => "gitlabhq_1" + @p2 = Factory :project, code: "alien", path: "gitlabhq_1" @u1 = Factory :user @u2 = Factory :user @u3 = Factory :user @@ -102,8 +102,8 @@ describe Note do describe :read do before do - @p1.users_projects.create(:user => @u2, :project_access => UsersProject::GUEST) - @p2.users_projects.create(:user => @u3, :project_access => UsersProject::GUEST) + @p1.users_projects.create(user: @u2, project_access: UsersProject::GUEST) + @p2.users_projects.create(user: @u3, project_access: UsersProject::GUEST) end it { @abilities.allowed?(@u1, :read_note, @p1).should be_false } @@ -113,8 +113,8 @@ describe Note do describe :write do before do - @p1.users_projects.create(:user => @u2, :project_access => UsersProject::DEVELOPER) - @p2.users_projects.create(:user => @u3, :project_access => UsersProject::DEVELOPER) + @p1.users_projects.create(user: @u2, project_access: UsersProject::DEVELOPER) + @p2.users_projects.create(user: @u3, project_access: UsersProject::DEVELOPER) end it { @abilities.allowed?(@u1, :write_note, @p1).should be_false } @@ -124,9 +124,9 @@ describe Note do describe :admin do before do - @p1.users_projects.create(:user => @u1, :project_access => UsersProject::REPORTER) - @p1.users_projects.create(:user => @u2, :project_access => UsersProject::MASTER) - @p2.users_projects.create(:user => @u3, :project_access => UsersProject::MASTER) + @p1.users_projects.create(user: @u1, project_access: UsersProject::REPORTER) + @p1.users_projects.create(user: @u2, project_access: UsersProject::MASTER) + @p2.users_projects.create(user: @u3, project_access: UsersProject::MASTER) end it { @abilities.allowed?(@u1, :admin_note, @p1).should be_false } diff --git a/spec/models/project_hooks_spec.rb b/spec/models/project_hooks_spec.rb index 5544c5a8683..129e3d61030 100644 --- a/spec/models/project_hooks_spec.rb +++ b/spec/models/project_hooks_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Project, "Hooks" do let(:project) { Factory :project } before do - @key = Factory :key, :user => project.owner + @key = Factory :key, user: project.owner @user = @key.user @key_id = @key.identifier end diff --git a/spec/models/project_security_spec.rb b/spec/models/project_security_spec.rb index bd697af9652..baf6d4b68ea 100644 --- a/spec/models/project_security_spec.rb +++ b/spec/models/project_security_spec.rb @@ -12,7 +12,7 @@ describe Project do describe "read access" do before do - @p1.users_projects.create(:project => @p1, :user => @u2, :project_access => UsersProject::REPORTER) + @p1.users_projects.create(project: @p1, user: @u2, project_access: UsersProject::REPORTER) end it { @abilities.allowed?(@u1, :read_project, @p1).should be_false } @@ -21,7 +21,7 @@ describe Project do describe "write access" do before do - @p1.users_projects.create(:project => @p1, :user => @u2, :project_access => UsersProject::DEVELOPER) + @p1.users_projects.create(project: @p1, user: @u2, project_access: UsersProject::DEVELOPER) end it { @abilities.allowed?(@u1, :write_project, @p1).should be_false } @@ -30,8 +30,8 @@ describe Project do describe "admin access" do before do - @p1.users_projects.create(:project => @p1, :user => @u1, :project_access => UsersProject::DEVELOPER) - @p1.users_projects.create(:project => @p1, :user => @u2, :project_access => UsersProject::MASTER) + @p1.users_projects.create(project: @p1, user: @u1, project_access: UsersProject::DEVELOPER) + @p1.users_projects.create(project: @p1, user: @u2, project_access: UsersProject::MASTER) end it { @abilities.allowed?(@u1, :admin_project, @p1).should be_false } diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 2c8ddd5c718..5bba4ff6c96 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -80,17 +80,17 @@ describe Project do end it "should return valid url to repo" do - project = Project.new(:path => "somewhere") + project = Project.new(path: "somewhere") project.url_to_repo.should == Gitlab.config.ssh_path + "somewhere.git" end it "should return path to repo" do - project = Project.new(:path => "somewhere") + project = Project.new(path: "somewhere") project.path_to_repo.should == File.join(Rails.root, "tmp", "tests", "somewhere") end it "returns the full web URL for this repo" do - project = Project.new(:code => "somewhere") + project = Project.new(code: "somewhere") project.web_url.should == "#{Gitlab.config.url}/somewhere" end @@ -101,7 +101,7 @@ describe Project do end it "should be invalid repo" do - project = Project.new(:name => "ok_name", :path => "/INVALID_PATH/", :code => "NEOK") + project = Project.new(name: "ok_name", path: "/INVALID_PATH/", code: "NEOK") project.valid_repo?.should be_false end end @@ -121,7 +121,7 @@ describe Project do let(:project) { Factory :project } it 'returns the creation date of the project\'s last event if present' do - last_event = double(:created_at => 'now') + last_event = double(created_at: 'now') project.stub(:events).and_return( [double, double, last_event] ) project.last_activity_date.should == last_event.created_at end @@ -161,7 +161,7 @@ describe Project do end it "should return nil" do - lambda { Project.new(:path => "invalid").repo }.should raise_error(Grit::NoSuchPathError) + lambda { Project.new(path: "invalid").repo }.should raise_error(Grit::NoSuchPathError) end it "should return nil" do @@ -214,10 +214,10 @@ describe Project do before do @merge_request = Factory :merge_request, - :project => project, - :merged => false, - :closed => false - @key = Factory :key, :user_id => project.owner.id + project: project, + merged: false, + closed: false + @key = Factory :key, user_id: project.owner.id end it "should close merge request if last commit from source branch was pushed to target branch" do diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb index 6724fb8db1b..1654e3b6f56 100644 --- a/spec/models/protected_branch_spec.rb +++ b/spec/models/protected_branch_spec.rb @@ -24,7 +24,7 @@ describe ProtectedBranch do end describe 'Callbacks' do - subject { ProtectedBranch.new(:project => project, :name => 'branch_name') } + subject { ProtectedBranch.new(project: project, name: 'branch_name') } it 'call update_repository after save' do subject.should_receive(:update_repository) @@ -38,7 +38,7 @@ describe ProtectedBranch do end describe '#commit' do - subject { ProtectedBranch.new(:project => project, :name => 'cant_touch_this') } + subject { ProtectedBranch.new(project: project, name: 'cant_touch_this') } it 'commits itself to its project' do project.should_receive(:commit).with('cant_touch_this') diff --git a/spec/models/system_hook_spec.rb b/spec/models/system_hook_spec.rb index 4ad4d1681fc..56d76ed08cf 100644 --- a/spec/models/system_hook_spec.rb +++ b/spec/models/system_hook_spec.rb @@ -12,7 +12,7 @@ describe SystemHook do it "project_create hook" do user = Factory :user with_resque do - project = Factory :project_without_owner, :owner => user + project = Factory :project_without_owner, owner: user end WebMock.should have_requested(:post, @system_hook.url).with(body: /project_create/).once end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 89e0f96f51c..265dcef1e77 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -18,29 +18,29 @@ describe User do end it "should return valid identifier" do - user = User.new(:email => "test@mail.com") + user = User.new(email: "test@mail.com") user.identifier.should == "test_mail_com" end it "should return identifier without + sign" do - user = User.new(:email => "test+foo@mail.com") + user = User.new(email: "test+foo@mail.com") user.identifier.should == "test_foo_mail_com" end it "should execute callback when force_random_password specified" do - user = User.new(:email => "test@mail.com", :force_random_password => true) + user = User.new(email: "test@mail.com", force_random_password: true) user.should_receive(:generate_password) user.save end it "should not generate password by default" do - user = Factory(:user, :password => 'abcdefg', :password_confirmation => 'abcdefg') + user = Factory(:user, password: 'abcdefg', password_confirmation: 'abcdefg') user.password.should == 'abcdefg' end it "should generate password when forcing random password" do Devise.stub(:friendly_token).and_return('123456789') - user = User.create(:email => "test1@mail.com", :force_random_password => true) + user = User.create(email: "test1@mail.com", force_random_password: true) user.password.should == user.password_confirmation user.password.should == '12345678' end @@ -54,8 +54,8 @@ describe User do before do @user = Factory :user @note = Factory :note, - :author => @user, - :project => Factory(:project) + author: @user, + project: Factory(:project) end it "should destroy all notes with user" do diff --git a/spec/requests/admin/admin_hooks_spec.rb b/spec/requests/admin/admin_hooks_spec.rb index e8a345b689f..2f026aabab8 100644 --- a/spec/requests/admin/admin_hooks_spec.rb +++ b/spec/requests/admin/admin_hooks_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe "Admin::Hooks" do before do @project = Factory :project, - :name => "LeGiT", - :code => "LGT" + name: "LeGiT", + code: "LGT" login_as :admin @system_hook = Factory :system_hook @@ -30,7 +30,7 @@ describe "Admin::Hooks" do before do @url = Faker::Internet.uri("http") visit admin_hooks_path - fill_in "hook_url", :with => @url + fill_in "hook_url", with: @url expect { click_button "Add System Hook" }.to change(SystemHook, :count).by(1) end diff --git a/spec/requests/admin/admin_projects_spec.rb b/spec/requests/admin/admin_projects_spec.rb index 37cb7d6704d..0ce66f5f868 100644 --- a/spec/requests/admin/admin_projects_spec.rb +++ b/spec/requests/admin/admin_projects_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe "Admin::Projects" do before do @project = Factory :project, - :name => "LeGiT", - :code => "LGT" + name: "LeGiT", + code: "LGT" login_as :admin end @@ -47,8 +47,8 @@ describe "Admin::Projects" do describe "Update project" do before do - fill_in "project_name", :with => "Big Bang" - fill_in "project_code", :with => "BB1" + fill_in "project_name", with: "Big Bang" + fill_in "project_code", with: "BB1" click_button "Save Project" @project.reload end @@ -85,9 +85,9 @@ describe "Admin::Projects" do describe "POST /admin/projects" do before do visit new_admin_project_path - fill_in 'project_name', :with => 'NewProject' - fill_in 'project_code', :with => 'NPR' - fill_in 'project_path', :with => 'gitlabhq_1' + fill_in 'project_name', with: 'NewProject' + fill_in 'project_code', with: 'NPR' + fill_in 'project_path', with: 'gitlabhq_1' expect { click_button "Create project" }.to change { Project.count }.by(1) @project = Project.last end @@ -109,7 +109,7 @@ describe "Admin::Projects" do end it "should create new user" do - select @new_user.name, :from => "user_ids" + select @new_user.name, from: "user_ids" expect { click_button "Add" }.to change { UsersProject.count }.by(1) page.should have_content @new_user.name current_path.should == admin_project_path(@project) diff --git a/spec/requests/admin/admin_users_spec.rb b/spec/requests/admin/admin_users_spec.rb index ba6831e3d8b..68358bf0a0f 100644 --- a/spec/requests/admin/admin_users_spec.rb +++ b/spec/requests/admin/admin_users_spec.rb @@ -22,10 +22,10 @@ describe "Admin::Users" do before do @password = "123ABC" visit new_admin_user_path - fill_in "user_name", :with => "Big Bang" - fill_in "user_email", :with => "bigbang@mail.com" - fill_in "user_password", :with => @password - fill_in "user_password_confirmation", :with => @password + fill_in "user_name", with: "Big Bang" + fill_in "user_email", with: "bigbang@mail.com" + fill_in "user_password", with: @password + fill_in "user_password_confirmation", with: @password end it "should create new user" do @@ -40,7 +40,7 @@ describe "Admin::Users" do end it "should call send mail" do - Notify.should_receive(:new_user_email).and_return(stub(:deliver => true)) + Notify.should_receive(:new_user_email).and_return(stub(deliver: true)) User.observers.enable :user_observer do click_button "Save" @@ -88,8 +88,8 @@ describe "Admin::Users" do describe "Update user" do before do - fill_in "user_name", :with => "Big Bang" - fill_in "user_email", :with => "bigbang@mail.com" + fill_in "user_name", with: "Big Bang" + fill_in "user_email", with: "bigbang@mail.com" check "user_admin" click_button "Save" end @@ -114,7 +114,7 @@ describe "Admin::Users" do end it "should create new user" do - select @new_project.name, :from => "project_ids" + select @new_project.name, from: "project_ids" expect { click_button "Add" }.to change { UsersProject.count }.by(1) page.should have_content @new_project.name current_path.should == admin_user_path(@user) diff --git a/spec/requests/atom/dashboard_issues_spec.rb b/spec/requests/atom/dashboard_issues_spec.rb index 7260dcf47bf..9b4ffc0e326 100644 --- a/spec/requests/atom/dashboard_issues_spec.rb +++ b/spec/requests/atom/dashboard_issues_spec.rb @@ -7,40 +7,40 @@ describe "User Issues Dashboard" do login_as :user @project1 = Factory :project, - :path => "project1", - :code => "TEST1" + path: "project1", + code: "TEST1" @project2 = Factory :project, - :path => "project2", - :code => "TEST2" + path: "project2", + code: "TEST2" @project1.add_access(@user, :read, :write) @project2.add_access(@user, :read, :write) @issue1 = Factory :issue, - :author => @user, - :assignee => @user, - :project => @project1 + author: @user, + assignee: @user, + project: @project1 @issue2 = Factory :issue, - :author => @user, - :assignee => @user, - :project => @project2 + author: @user, + assignee: @user, + project: @project2 visit dashboard_issues_path end - describe "atom feed", :js => false do + describe "atom feed", js: false do it "should render atom feed via private token" do logout - visit dashboard_issues_path(:atom, :private_token => @user.private_token) + visit dashboard_issues_path(:atom, private_token: @user.private_token) page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "#{@user.name} issues") - page.body.should have_selector("author email", :text => @issue1.author_email) - page.body.should have_selector("entry summary", :text => @issue1.title) - page.body.should have_selector("author email", :text => @issue2.author_email) - page.body.should have_selector("entry summary", :text => @issue2.title) + page.body.should have_selector("title", text: "#{@user.name} issues") + page.body.should have_selector("author email", text: @issue1.author_email) + page.body.should have_selector("entry summary", text: @issue1.title) + page.body.should have_selector("author email", text: @issue2.author_email) + page.body.should have_selector("entry summary", text: @issue2.title) end end end diff --git a/spec/requests/atom/dashboard_spec.rb b/spec/requests/atom/dashboard_spec.rb index 4db8ce49ff7..00c7a5255ca 100644 --- a/spec/requests/atom/dashboard_spec.rb +++ b/spec/requests/atom/dashboard_spec.rb @@ -5,7 +5,7 @@ describe "User Dashboard" do describe "GET /" do before do - @project = Factory :project, :owner => @user + @project = Factory :project, owner: @user @project.add_access(@user, :read) visit dashboard_path end @@ -13,14 +13,14 @@ describe "User Dashboard" do it "should render projects atom feed via private token" do logout - visit dashboard_path(:atom, :private_token => @user.private_token) + visit dashboard_path(:atom, private_token: @user.private_token) page.body.should have_selector("feed title") end it "should not render projects page via private token" do logout - visit dashboard_path(:private_token => @user.private_token) + visit dashboard_path(private_token: @user.private_token) current_path.should == new_user_session_path end end diff --git a/spec/requests/atom/issues_spec.rb b/spec/requests/atom/issues_spec.rb index 8d0b6c4f3fd..468d1b2260a 100644 --- a/spec/requests/atom/issues_spec.rb +++ b/spec/requests/atom/issues_spec.rb @@ -11,9 +11,9 @@ describe "Issues" do describe "GET /issues" do before do @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project + author: @user, + assignee: @user, + project: project visit project_issues_path(project) end @@ -22,19 +22,19 @@ describe "Issues" do visit project_issues_path(project, :atom) page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "#{project.name} issues") - page.body.should have_selector("author email", :text => @issue.author_email) - page.body.should have_selector("entry summary", :text => @issue.title) + page.body.should have_selector("title", text: "#{project.name} issues") + page.body.should have_selector("author email", text: @issue.author_email) + page.body.should have_selector("entry summary", text: @issue.title) end it "should render atom feed via private token" do logout - visit project_issues_path(project, :atom, :private_token => @user.private_token) + visit project_issues_path(project, :atom, private_token: @user.private_token) page.response_headers['Content-Type'].should have_content("application/atom+xml") - page.body.should have_selector("title", :text => "#{project.name} issues") - page.body.should have_selector("author email", :text => @issue.author_email) - page.body.should have_selector("entry summary", :text => @issue.title) + page.body.should have_selector("title", text: "#{project.name} issues") + page.body.should have_selector("author email", text: @issue.author_email) + page.body.should have_selector("entry summary", text: @issue.title) end end end diff --git a/spec/requests/gitlab_flavored_markdown_spec.rb b/spec/requests/gitlab_flavored_markdown_spec.rb index 06ae6841d4f..1076e90c42b 100644 --- a/spec/requests/gitlab_flavored_markdown_spec.rb +++ b/spec/requests/gitlab_flavored_markdown_spec.rb @@ -2,10 +2,10 @@ require 'spec_helper' describe "Gitlab Flavored Markdown" do let(:project) { Factory :project } - let(:issue) { Factory :issue, :project => project } - let(:merge_request) { Factory :merge_request, :project => project } + let(:issue) { Factory :issue, project: project } + let(:merge_request) { Factory :merge_request, project: project } let(:fred) do - u = Factory :user, :name => "fred" + u = Factory :user, name: "fred" project.users << u u end @@ -19,7 +19,7 @@ describe "Gitlab Flavored Markdown" do @test_file = "gfm_test_file" i.add(@test_file, "foo\nbar\n") # add commit with gfm - i.commit("fix ##{issue.id}\n\nask @#{fred.name} for details", :head => @branch_name) + i.commit("fix ##{issue.id}\n\nask @#{fred.name} for details", head: @branch_name) # add test tag @tag_name = "gfm-test-tag" @@ -27,8 +27,8 @@ describe "Gitlab Flavored Markdown" do end after do # delete test branch and tag - project.repo.git.native(:branch, {:D => true}, @branch_name) - project.repo.git.native(:tag, {:d => true}, @tag_name) + project.repo.git.native(:branch, {D: true}, @branch_name) + project.repo.git.native(:tag, {d: true}, @tag_name) project.repo.gc_auto end @@ -42,25 +42,25 @@ describe "Gitlab Flavored Markdown" do describe "for commits" do it "should render title in commits#index" do - visit project_commits_path(project, :ref => @branch_name) + visit project_commits_path(project, ref: @branch_name) page.should have_link("##{issue.id}") end it "should render title in commits#show" do - visit project_commit_path(project, :id => commit.id) + visit project_commit_path(project, id: commit.id) page.should have_link("##{issue.id}") end it "should render description in commits#show" do - visit project_commit_path(project, :id => commit.id) + visit project_commit_path(project, id: commit.id) page.should have_link("@#{fred.name}") end - it "should render title in refs#tree", :js => true do - visit tree_project_ref_path(project, :id => @branch_name) + it "should render title in refs#tree", js: true do + visit tree_project_ref_path(project, id: @branch_name) within(".tree_commit") do page.should have_link("##{issue.id}") @@ -68,7 +68,7 @@ describe "Gitlab Flavored Markdown" do end it "should render title in refs#blame" do - visit blame_file_project_ref_path(project, :id => @branch_name, :path => @test_file) + visit blame_file_project_ref_path(project, id: @branch_name, path: @test_file) within(".blame_commit") do page.should have_link("##{issue.id}") @@ -92,15 +92,15 @@ describe "Gitlab Flavored Markdown" do describe "for issues" do before do @other_issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project + author: @user, + assignee: @user, + project: project @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project, - :title => "fix ##{@other_issue.id}", - :description => "ask @#{fred.name} for details" + author: @user, + assignee: @user, + project: project, + title: "fix ##{@other_issue.id}", + description: "ask @#{fred.name} for details" end it "should render subject in issues#index" do @@ -126,8 +126,8 @@ describe "Gitlab Flavored Markdown" do describe "for merge requests" do before do @merge_request = Factory :merge_request, - :project => project, - :title => "fix ##{issue.id}" + project: project, + title: "fix ##{issue.id}" end it "should render title in merge_requests#index" do @@ -147,9 +147,9 @@ describe "Gitlab Flavored Markdown" do describe "for milestones" do before do @milestone = Factory :milestone, - :project => project, - :title => "fix ##{issue.id}", - :description => "ask @#{fred.name} for details" + project: project, + title: "fix ##{issue.id}", + description: "ask @#{fred.name} for details" end it "should render title in milestones#index" do @@ -173,45 +173,45 @@ describe "Gitlab Flavored Markdown" do describe "for notes" do - it "should render in commits#show", :js => true do - visit project_commit_path(project, :id => commit.id) - fill_in "note_note", :with => "see ##{issue.id}" + it "should render in commits#show", js: true do + visit project_commit_path(project, id: commit.id) + fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" page.should have_link("##{issue.id}") end - it "should render in issue#show", :js => true do + it "should render in issue#show", js: true do visit project_issue_path(project, issue) - fill_in "note_note", :with => "see ##{issue.id}" + fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" page.should have_link("##{issue.id}") end - it "should render in merge_request#show", :js => true do + it "should render in merge_request#show", js: true do visit project_merge_request_path(project, merge_request) - fill_in "note_note", :with => "see ##{issue.id}" + fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" page.should have_link("##{issue.id}") end - it "should render in projects#wall", :js => true do + it "should render in projects#wall", js: true do visit wall_project_path(project) - fill_in "note_note", :with => "see ##{issue.id}" + fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" page.should have_link("##{issue.id}") end - it "should render in wikis#index", :js => true do + it "should render in wikis#index", js: true do visit project_wiki_path(project, :index) - fill_in "Title", :with => 'Test title' - fill_in "Content", :with => '[link test](test)' + fill_in "Title", with: 'Test title' + fill_in "Content", with: '[link test](test)' click_on "Save" - fill_in "note_note", :with => "see ##{issue.id}" + fill_in "note_note", with: "see ##{issue.id}" click_button "Add Comment" page.should have_link("##{issue.id}") @@ -222,8 +222,8 @@ describe "Gitlab Flavored Markdown" do describe "for wikis" do before do visit project_wiki_path(project, :index) - fill_in "Title", :with => "Circumvent ##{issue.id}" - fill_in "Content", :with => "# Other pages\n\n* [Foo](foo)\n* [Bar](bar)\n\nAlso look at ##{issue.id} :-)" + fill_in "Title", with: "Circumvent ##{issue.id}" + fill_in "Content", with: "# Other pages\n\n* [Foo](foo)\n* [Bar](bar)\n\nAlso look at ##{issue.id} :-)" click_on "Save" end diff --git a/spec/requests/hooks_spec.rb b/spec/requests/hooks_spec.rb index 05432f13f3c..7cfe7cfe849 100644 --- a/spec/requests/hooks_spec.rb +++ b/spec/requests/hooks_spec.rb @@ -9,7 +9,7 @@ describe "Hooks" do describe "GET index" do it "should be available" do - @hook = Factory :project_hook, :project => @project + @hook = Factory :project_hook, project: @project visit project_hooks_path(@project) page.should have_content "Hooks" page.should have_content @hook.url @@ -20,7 +20,7 @@ describe "Hooks" do before do @url = Faker::Internet.uri("http") visit project_hooks_path(@project) - fill_in "hook_url", :with => @url + fill_in "hook_url", with: @url expect { click_button "Add Web Hook" }.to change(ProjectHook, :count).by(1) end @@ -32,7 +32,7 @@ describe "Hooks" do describe "Test" do before do - @hook = Factory :project_hook, :project => @project + @hook = Factory :project_hook, project: @project stub_request(:post, @hook.url) visit project_hooks_path(@project) click_link "Test Hook" diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb index ad7b0432f42..24c21db8476 100644 --- a/spec/requests/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -11,12 +11,12 @@ describe "Issues" do project.add_access(@user2, :read, :write) end - describe "Edit issue", :js => true do + describe "Edit issue", js: true do before do @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project + author: @user, + assignee: @user, + project: project visit project_issues_path(project) click_link "Edit" end @@ -27,8 +27,8 @@ describe "Issues" do describe "fill in" do before do - fill_in "issue_title", :with => "bug 345" - fill_in "issue_description", :with => "bug description" + fill_in "issue_title", with: "bug 345" + fill_in "issue_description", with: "bug description" end it { expect { click_button "Save changes" }.to_not change {Issue.count} } @@ -43,14 +43,14 @@ describe "Issues" do end end - describe "Search issue", :js => true do + describe "Search issue", js: true do before do ['foobar', 'foobar2', 'gitlab'].each do |title| @issue = Factory :issue, - :author => @user, - :assignee => @user, - :project => project, - :title => title + author: @user, + assignee: @user, + project: project, + title: title @issue.save end end @@ -62,7 +62,7 @@ describe "Issues" do visit project_issues_path(project) click_link 'Closed' - fill_in 'issue_search', :with => 'foobar' + fill_in 'issue_search', with: 'foobar' page.should have_content 'foobar' page.should_not have_content 'foobar2' @@ -71,7 +71,7 @@ describe "Issues" do it "should search for term and return the correct results" do visit project_issues_path(project) - fill_in 'issue_search', :with => 'foobar' + fill_in 'issue_search', with: 'foobar' page.should have_content 'foobar' page.should have_content 'foobar2' @@ -80,8 +80,8 @@ describe "Issues" do it "should return all results if term has been cleared" do visit project_issues_path(project) - fill_in "issue_search", :with => "foobar" - # Because fill_in, :with => "" triggers nothing we need to trigger a keyup event + fill_in "issue_search", with: "foobar" + # Because fill_in, with: "" triggers nothing we need to trigger a keyup event page.execute_script("$('.issue_search').val('').keyup();"); page.should have_content 'foobar' diff --git a/spec/requests/projects_deploy_keys_spec.rb b/spec/requests/projects_deploy_keys_spec.rb index 580e55229e1..0fea7b46ce2 100644 --- a/spec/requests/projects_deploy_keys_spec.rb +++ b/spec/requests/projects_deploy_keys_spec.rb @@ -10,7 +10,7 @@ describe "Projects", "DeployKeys" do describe "GET /keys" do before do - @key = Factory :key, :project => project + @key = Factory :key, project: project visit project_deploy_keys_path(project) end @@ -41,8 +41,8 @@ describe "Projects", "DeployKeys" do describe "fill in" do before do - fill_in "key_title", :with => "laptop" - fill_in "key_key", :with => "publickey234=" + fill_in "key_title", with: "laptop" + fill_in "key_key", with: "publickey234=" end it { expect { click_button "Save" }.to change {Key.count}.by(1) } @@ -57,7 +57,7 @@ describe "Projects", "DeployKeys" do describe "Show page" do before do - @key = Factory :key, :project => project + @key = Factory :key, project: project visit project_deploy_key_path(project, @key) end diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb index f96affc75bc..63f8a696754 100644 --- a/spec/requests/projects_spec.rb +++ b/spec/requests/projects_spec.rb @@ -5,7 +5,7 @@ describe "Projects" do describe "GET /projects/show" do before do - @project = Factory :project, :owner => @user + @project = Factory :project, owner: @user @project.add_access(@user, :read) visit project_path(@project) @@ -37,13 +37,13 @@ describe "Projects" do describe "PUT /projects/:id" do before do - @project = Factory :project, :owner => @user + @project = Factory :project, owner: @user @project.add_access(@user, :admin, :read) visit edit_project_path(@project) - fill_in 'project_name', :with => 'Awesome' - fill_in 'project_code', :with => 'gitlabhq' + fill_in 'project_name', with: 'Awesome' + fill_in 'project_code', with: 'gitlabhq' click_button "Save" @project = @project.reload end diff --git a/spec/requests/search_spec.rb b/spec/requests/search_spec.rb index 377bc215a04..537c4d0c64c 100644 --- a/spec/requests/search_spec.rb +++ b/spec/requests/search_spec.rb @@ -6,7 +6,7 @@ describe "Search" do @project = Factory :project @project.add_access(@user, :read) visit search_path - fill_in "search", :with => @project.name[0..3] + fill_in "search", with: @project.name[0..3] click_button "Search" end diff --git a/spec/requests/security/project_access_spec.rb b/spec/requests/security/project_access_spec.rb index bcca42f5298..d503cf857b5 100644 --- a/spec/requests/security/project_access_spec.rb +++ b/spec/requests/security/project_access_spec.rb @@ -20,9 +20,9 @@ describe "Application access" do @u2 = Factory :user @u3 = Factory :user # full access - @project.users_projects.create(:user => @u1, :project_access => UsersProject::MASTER) + @project.users_projects.create(user: @u1, project_access: UsersProject::MASTER) # readonly - @project.users_projects.create(:user => @u3, :project_access => UsersProject::REPORTER) + @project.users_projects.create(user: @u3, project_access: UsersProject::REPORTER) end describe "GET /project_code" do @@ -83,7 +83,7 @@ describe "Application access" do before do @commit = @project.commit @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name - @blob_path = blob_project_ref_path(@project, @commit.id, :path => @path) + @blob_path = blob_project_ref_path(@project, @commit.id, path: @path) end it { @blob_path.should be_allowed_for @u1 } diff --git a/spec/requests/snippets_spec.rb b/spec/requests/snippets_spec.rb index 9b9bb0e96c5..6b993660507 100644 --- a/spec/requests/snippets_spec.rb +++ b/spec/requests/snippets_spec.rb @@ -11,8 +11,8 @@ describe "Snippets" do describe "GET /snippets" do before do @snippet = Factory :snippet, - :author => @user, - :project => project + author: @user, + project: project visit project_snippets_path(project) end @@ -50,9 +50,9 @@ describe "Snippets" do describe "fill in" do before do - fill_in "snippet_title", :with => "login function" - fill_in "snippet_file_name", :with => "test.rb" - fill_in "snippet_content", :with => "def login; end" + fill_in "snippet_title", with: "login function" + fill_in "snippet_file_name", with: "test.rb" + fill_in "snippet_content", with: "def login; end" end it { expect { click_button "Save" }.to change {Snippet.count}.by(1) } @@ -69,8 +69,8 @@ describe "Snippets" do describe "Edit snippet" do before do @snippet = Factory :snippet, - :author => @user, - :project => project + author: @user, + project: project visit project_snippet_path(project, @snippet) click_link "Edit" end @@ -81,9 +81,9 @@ describe "Snippets" do describe "fill in" do before do - fill_in "snippet_title", :with => "login function" - fill_in "snippet_file_name", :with => "test.rb" - fill_in "snippet_content", :with => "def login; end" + fill_in "snippet_title", with: "login function" + fill_in "snippet_file_name", with: "test.rb" + fill_in "snippet_content", with: "def login; end" end it { expect { click_button "Save" }.to_not change {Snippet.count} } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 65e7e529a5b..31ca2a2b64e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -37,7 +37,7 @@ RSpec.configure do |config| # instead of true. config.use_transactional_fixtures = false - config.before :each, :type => :integration do + config.before :each, type: :integration do DeviseSessionMock.disable end @@ -59,7 +59,7 @@ RSpec.configure do |config| DatabaseCleaner.clean end - config.include RSpec::Rails::RequestExampleGroup, :type => :request, :example_group => { - :file_path => /spec\/api/ + config.include RSpec::Rails::RequestExampleGroup, type: :request, example_group: { + file_path: /spec\/api/ } end diff --git a/spec/support/login.rb b/spec/support/login.rb index 026e336df58..78a907bad0b 100644 --- a/spec/support/login.rb +++ b/spec/support/login.rb @@ -1,10 +1,10 @@ module LoginMacros def login_as role - @user = User.create(:email => "user#{User.count}@mail.com", - :name => "John Smith", - :password => "123456", - :password_confirmation => "123456", - :skype => 'user_skype') + @user = User.create(email: "user#{User.count}@mail.com", + name: "John Smith", + password: "123456", + password_confirmation: "123456", + skype: 'user_skype') if role == :admin @user.admin = true @@ -12,15 +12,15 @@ module LoginMacros end visit new_user_session_path - fill_in "user_email", :with => @user.email - fill_in "user_password", :with => "123456" + fill_in "user_email", with: @user.email + fill_in "user_password", with: "123456" click_button "Sign in" end def login_with(user) visit new_user_session_path - fill_in "user_email", :with => user.email - fill_in "user_password", :with => "123456" + fill_in "user_email", with: user.email + fill_in "user_password", with: "123456" click_button "Sign in" end diff --git a/spec/support/valid_commit.rb b/spec/support/valid_commit.rb index 8094b679e99..0af36e34293 100644 --- a/spec/support/valid_commit.rb +++ b/spec/support/valid_commit.rb @@ -9,7 +9,7 @@ module ValidCommit C_FILE_PATH = "app/models" C_FILES = [".gitkeep", "ability.rb", "commit.rb", "issue.rb", "key.rb", "mailer_observer.rb", "merge_request.rb", "note.rb", "project.rb", "protected_branch.rb", "repository.rb", "snippet.rb", "tree.rb", "user.rb", "users_project.rb", "web_hook.rb", "wiki.rb"] - BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n} + BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, confirm: 'Are you sure?', method: :delete, class: \"btn danger delete-key\"\n\n\n} BLOB_FILE_PATH = "app/views/keys/show.html.haml" end diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb index 5f3b6d3daec..6f4bcca2bf2 100644 --- a/spec/workers/post_receive_spec.rb +++ b/spec/workers/post_receive_spec.rb @@ -10,7 +10,7 @@ describe PostReceive do context "web hook" do let(:project) { Factory.create(:project) } - let(:key) { Factory.create(:key, :user => project.owner) } + let(:key) { Factory.create(:key, user: project.owner) } let(:key_id) { key.identifier } it "fetches the correct project" do |
