Skip to content
Snippets Groups Projects
Commit 9ba12248 authored by gitlabhq's avatar gitlabhq
Browse files

init commit

parent 93efff94
No related branches found
No related tags found
No related merge requests found
Showing
with 1204 additions and 0 deletions
require File.join(Rails.root, 'spec', 'factory')
Factory.add(:project, Project) do |obj|
obj.name = Faker::Internet.user_name
obj.path = 'legit'
obj.code = 'LGT'
end
Factory.add(:public_project, Project) do |obj|
obj.name = Faker::Internet.user_name
obj.path = 'legit'
obj.private_flag = false
obj.code = 'LGT'
end
Factory.add(:user, User) do |obj|
obj.email = Faker::Internet.email
obj.password = "123456"
obj.name = Faker::Name.name
obj.password_confirmation = "123456"
end
Factory.add(:admin, User) do |obj|
obj.email = Faker::Internet.email
obj.password = "123456"
obj.name = Faker::Name.name
obj.password_confirmation = "123456"
obj.admin = true
end
Factory.add(:issue, Issue) do |obj|
obj.title = Faker::Lorem.sentence
obj.content = Faker::Lorem.sentences
end
Factory.add(:note, Note) do |obj|
obj.note = Faker::Lorem.sentence
end
Factory.add(:key, Key) do |obj|
obj.title = "Example key"
obj.key = File.read(File.join(Rails.root, "db", "pkey.example"))
end
class Factory
@factories = {}
class << self
def add(name, klass, &block)
@factories[name] = [klass, block]
end
def create(name, opts = {})
new(name, opts).tap(&:save!)
end
def new(name, opts)
factory = @factories[name]
factory[0].new.tap do |obj|
factory[1].call(obj)
end.tap do |obj|
opts.each do |k, opt|
obj.send("#{k}=", opt)
end
end
end
end
end
def Factory(name, opts={})
Factory.create name, opts
end
require 'spec_helper'
describe Issue do
describe "Associations" do
it { should belong_to(:project) }
it { should belong_to(:author) }
it { should belong_to(:assignee) }
end
describe "Validation" do
it { should validate_presence_of(:title) }
it { should validate_presence_of(:author_id) }
it { should validate_presence_of(:project_id) }
it { should validate_presence_of(:assignee_id) }
end
describe "Scope" do
it { Issue.should respond_to :closed }
it { Issue.should respond_to :opened }
end
it { Factory.create(:issue,
:author => Factory(:user),
:assignee => Factory(:user),
:project => Factory.create(:project)).should be_valid }
end
# == Schema Information
#
# Table name: issues
#
# id :integer not null, primary key
# title :string(255)
# content :text
# assignee_id :integer
# author_id :integer
# project_id :integer
# created_at :datetime
# updated_at :datetime
# closed :boolean default(FALSE), not null
#
require 'spec_helper'
describe Key do
describe "Associations" do
it { should belong_to(:user) }
end
describe "Validation" do
it { should validate_presence_of(:title) }
it { should validate_presence_of(:key) }
end
describe "Methods" do
it { should respond_to :projects }
end
it { Factory.create(:key,
:user => Factory(:user)).should be_valid }
end
# == Schema Information
#
# Table name: keys
#
# id :integer not null, primary key
# user_id :integer not null
# created_at :datetime
# updated_at :datetime
# key :text
# title :string(255)
# identifier :string(255)
#
require 'spec_helper'
describe Note do
describe "Associations" do
it { should belong_to(:project) }
end
describe "Validation" do
it { should validate_presence_of(:note) }
it { should validate_presence_of(:project) }
end
it { Factory.create(:note,
:project => Factory.create(:project)).should be_valid }
describe :authorization do
before do
@p1 = Factory :project
@p2 = Factory :project, :code => "alien", :path => "legit_1"
@u1 = Factory :user
@u2 = Factory :user
@u3 = Factory :user
@abilities = Six.new
@abilities << Ability
end
describe :read do
before do
@p1.users_projects.create(:user => @u1, :read => false)
@p1.users_projects.create(:user => @u2, :read => true)
@p2.users_projects.create(:user => @u3, :read => true)
end
it { @abilities.allowed?(@u1, :read_note, @p1).should be_false }
it { @abilities.allowed?(@u2, :read_note, @p1).should be_true }
it { @abilities.allowed?(@u3, :read_note, @p1).should be_false }
end
describe :write do
before do
@p1.users_projects.create(:user => @u1, :write => false)
@p1.users_projects.create(:user => @u2, :write => true)
@p2.users_projects.create(:user => @u3, :write => true)
end
it { @abilities.allowed?(@u1, :write_note, @p1).should be_false }
it { @abilities.allowed?(@u2, :write_note, @p1).should be_true }
it { @abilities.allowed?(@u3, :write_note, @p1).should be_false }
end
describe :admin do
before do
@p1.users_projects.create(:user => @u1, :admin => false)
@p1.users_projects.create(:user => @u2, :admin => true)
@p2.users_projects.create(:user => @u3, :admin => true)
end
it { @abilities.allowed?(@u1, :admin_note, @p1).should be_false }
it { @abilities.allowed?(@u2, :admin_note, @p1).should be_true }
it { @abilities.allowed?(@u3, :admin_note, @p1).should be_false }
end
end
end
# == Schema Information
#
# Table name: notes
#
# id :integer not null, primary key
# note :string(255)
# noteable_id :string(255)
# noteable_type :string(255)
# author_id :integer
# created_at :datetime
# updated_at :datetime
# project_id :integer
# attachment :string(255)
#
require 'spec_helper'
describe Project do
describe :authorization do
before do
@p1 = Factory :project
@u1 = Factory :user
@u2 = Factory :user
@abilities = Six.new
@abilities << Ability
end
describe :read do
before do
@p1.users_projects.create(:project => @p1, :user => @u1, :read => false)
@p1.users_projects.create(:project => @p1, :user => @u2, :read => true)
end
it { @abilities.allowed?(@u1, :read_project, @p1).should be_false }
it { @abilities.allowed?(@u2, :read_project, @p1).should be_true }
end
describe :write do
before do
@p1.users_projects.create(:project => @p1, :user => @u1, :write => false)
@p1.users_projects.create(:project => @p1, :user => @u2, :write => true)
end
it { @abilities.allowed?(@u1, :write_project, @p1).should be_false }
it { @abilities.allowed?(@u2, :write_project, @p1).should be_true }
end
describe :admin do
before do
@p1.users_projects.create(:project => @p1, :user => @u1, :admin => false)
@p1.users_projects.create(:project => @p1, :user => @u2, :admin => true)
end
it { @abilities.allowed?(@u1, :admin_project, @p1).should be_false }
it { @abilities.allowed?(@u2, :admin_project, @p1).should be_true }
end
end
end
# == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# name :string(255)
# path :string(255)
# description :text
# created_at :datetime
# updated_at :datetime
# private_flag :boolean default(TRUE), not null
# code :string(255)
#
require 'spec_helper'
describe Project do
describe "Associations" do
it { should have_many(:users) }
it { should have_many(:users_projects) }
end
describe "Validation" do
it { should validate_presence_of(:name) }
it { should validate_presence_of(:path) }
end
describe "Respond to" do
it { should respond_to(:readers) }
it { should respond_to(:writers) }
it { should respond_to(:gitosis_writers) }
it { should respond_to(:admins) }
it { should respond_to(:add_access) }
it { should respond_to(:reset_access) }
it { should respond_to(:update_gitosis_project) }
it { should respond_to(:destroy_gitosis_project) }
it { should respond_to(:public?) }
it { should respond_to(:private?) }
it { should respond_to(:url_to_repo) }
it { should respond_to(:path_to_repo) }
it { should respond_to(:valid_repo?) }
it { should respond_to(:repo_exists?) }
it { should respond_to(:repo) }
it { should respond_to(:tags) }
it { should respond_to(:commit) }
end
it "should return valid url to repo" do
project = Project.new(:path => "somewhere")
project.url_to_repo.should == "git@localhost:somewhere.git"
end
it "should return path to repo" do
project = Project.new(:path => "somewhere")
project.path_to_repo.should == "/tmp/somewhere"
end
describe :valid_repo? do
it "should be valid repo" do
project = Factory :project
project.valid_repo?.should be_true
end
it "should be invalid repo" do
project = Project.new(:name => "ok_name", :path => "/INVALID_PATH/", :code => "NEOK")
project.valid_repo?.should be_false
end
end
describe "Git methods" do
let(:project) { Factory :project }
describe :repo do
it "should return valid repo" do
project.repo.should be_kind_of(Grit::Repo)
end
it "should return nil" do
lambda { Project.new(:path => "invalid").repo }.should raise_error(Grit::NoSuchPathError)
end
it "should return nil" do
lambda { Project.new.repo }.should raise_error(TypeError)
end
end
describe :commit do
it "should return first head commit if without params" do
project.commit.id.should == project.repo.commits.first.id
end
it "should return valid commit" do
project.commit(ValidCommit::ID).should be_valid_commit
end
it "should return nil" do
project.commit("+123_4532530XYZ").should be_nil
end
end
describe :tree do
before do
@commit = project.commit(ValidCommit::ID)
end
it "should raise error w/o arguments" do
lambda { project.tree }.should raise_error
end
it "should return root tree for commit" do
tree = project.tree(@commit)
tree.contents.size.should == ValidCommit::FILES_COUNT
tree.contents.map(&:name).should == ValidCommit::FILES
end
it "should return root tree for commit with correct path" do
tree = project.tree(@commit, ValidCommit::C_FILE_PATH)
tree.contents.map(&:name).should == ValidCommit::C_FILES
end
it "should return root tree for commit with incorrect path" do
project.tree(@commit, "invalid_path").should be_nil
end
end
end
end
# == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# name :string(255)
# path :string(255)
# description :text
# created_at :datetime
# updated_at :datetime
# private_flag :boolean default(TRUE), not null
# code :string(255)
#
require 'spec_helper'
describe User do
describe "Associations" do
it { should have_many(:projects) }
it { should have_many(:users_projects) }
it { should have_many(:issues) }
it { should have_many(:assigned_issues) }
end
describe "Respond to" do
it { should respond_to(:is_admin?) }
it { should respond_to(:identifier) }
it { should respond_to(:name) }
end
it "should return valid identifier" do
user = User.new(:email => "test@mail.com")
user.identifier.should == "test_mail.com"
end
end
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string(255) default(""), not null
# encrypted_password :string(128) default(""), not null
# reset_password_token :string(255)
# reset_password_sent_at :datetime
# remember_created_at :datetime
# sign_in_count :integer default(0)
# current_sign_in_at :datetime
# last_sign_in_at :datetime
# current_sign_in_ip :string(255)
# last_sign_in_ip :string(255)
# created_at :datetime
# updated_at :datetime
# name :string(255)
# admin :boolean default(FALSE), not null
#
require 'spec_helper'
describe UsersProject do
describe "Associations" do
it { should belong_to(:project) }
it { should belong_to(:user) }
end
describe "Validation" do
it { should validate_presence_of(:user_id) }
it { should validate_presence_of(:project_id) }
end
describe "Delegate methods" do
it { should respond_to(:user_name) }
it { should respond_to(:user_email) }
end
end
# == Schema Information
#
# Table name: users_projects
#
# id :integer not null, primary key
# user_id :integer not null
# project_id :integer not null
# read :boolean default(FALSE)
# write :boolean default(FALSE)
# admin :boolean default(FALSE)
# created_at :datetime
# updated_at :datetime
#
# Stubbing Project <-> gitosis path
# create project using Factory only
class Project
def update_gitosis_project
true
end
def update_gitosis
true
end
def path_to_repo
"/tmp/" + path
end
end
class Key
def update_gitosis
true
end
def gitosis_delete_key
true
end
end
class UsersProject
def update_gitosis_project
true
end
end
require 'spec_helper'
describe "Admin::Projects" do
before do
@project = Factory :project,
:name => "LeGiT",
:code => "LGT"
login_as :admin
end
describe "GET /admin/projects" do
before do
visit admin_projects_path
end
it "should be ok" do
current_path.should == admin_projects_path
end
it "should have projects list" do
page.should have_content(@project.code)
page.should have_content(@project.name)
end
end
describe "GET /admin/projects/:id" do
before do
visit admin_projects_path
click_link "Show"
end
it "should have project info" do
page.should have_content(@project.code)
page.should have_content(@project.name)
end
end
describe "GET /admin/projects/:id/edit" do
before do
visit admin_projects_path
click_link "edit_project_#{@project.id}"
end
it "should have project edit page" do
page.should have_content("Name")
page.should have_content("Code")
end
describe "Update project" do
before do
fill_in "project_name", :with => "Big Bang"
fill_in "project_code", :with => "BB1"
click_button "Save"
@project.reload
end
it "should show page with new data" do
page.should have_content("BB1")
page.should have_content("Big Bang")
end
it "should change project entry" do
@project.name.should == "Big Bang"
@project.code.should == "BB1"
end
end
end
describe "GET /admin/projects/new" do
before do
visit admin_projects_path
click_link "New Project"
end
it "should be correct path" do
current_path.should == new_admin_project_path
end
it "should have labels for new project" do
page.should have_content("Name")
page.should have_content("Path")
page.should have_content("Description")
end
end
describe "POST /admin/projects" do
before do
visit new_admin_project_path
fill_in 'Name', :with => 'NewProject'
fill_in 'Code', :with => 'NPR'
fill_in 'Path', :with => '/tmp/legit_test/legit'
expect { click_button "Save" }.to change { Project.count }.by(1)
@project = Project.last
end
it "should be correct path" do
current_path.should == admin_project_path(@project)
end
it "should show project" do
page.should have_content(@project.name)
page.should have_content(@project.path)
page.should have_content(@project.description)
end
end
end
require 'spec_helper'
describe "Admin::Users" do
before { login_as :admin }
describe "GET /admin/users" do
before do
visit admin_users_path
end
it "should be ok" do
current_path.should == admin_users_path
end
it "should have users list" do
page.should have_content(@user.email)
page.should have_content(@user.name)
end
end
describe "GET /admin/users/new" 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
end
it "should create new user" do
expect { click_button "Save" }.to change {User.count}.by(1)
end
it "should create user with valid data" do
click_button "Save"
user = User.last
user.name.should == "Big Bang"
user.email.should == "bigbang@mail.com"
end
it "should call send mail" do
Notify.should_receive(:new_user_email).and_return(stub(:deliver => true))
click_button "Save"
end
it "should send valid email to user with email & password" do
click_button "Save"
user = User.last
email = ActionMailer::Base.deliveries.last
email.subject.should have_content("Account was created")
email.body.should have_content(user.email)
email.body.should have_content(@password)
end
end
describe "GET /admin/users/:id" do
before do
visit admin_users_path
click_link "Show"
end
it "should have user info" do
page.should have_content(@user.email)
page.should have_content(@user.name)
page.should have_content(@user.is_admin?)
end
end
describe "GET /admin/users/:id/edit" do
before do
@simple_user = Factory :user
visit admin_users_path
click_link "edit_user_#{@simple_user.id}"
end
it "should have user edit page" do
page.should have_content("Name")
page.should have_content("Password")
end
describe "Update user" do
before do
fill_in "user_name", :with => "Big Bang"
fill_in "user_email", :with => "bigbang@mail.com"
check "user_admin"
click_button "Save"
end
it "should show page with new data" do
page.should have_content("bigbang@mail.com")
page.should have_content("Big Bang")
end
it "should change user entry" do
@simple_user.reload
@simple_user.name.should == "Big Bang"
@simple_user.is_admin?.should be_true
end
end
end
end
require 'spec_helper'
describe "Admin::Projects" do
describe "GET /admin/projects" do
it { admin_projects_path.should be_allowed_for :admin }
it { admin_projects_path.should be_denied_for :user }
it { admin_projects_path.should be_denied_for :visitor }
end
describe "GET /admin/users" do
it { admin_users_path.should be_allowed_for :admin }
it { admin_users_path.should be_denied_for :user }
it { admin_users_path.should be_denied_for :visitor }
end
describe "GET /admin/team_members" do
it { admin_team_members_path.should be_allowed_for :admin }
it { admin_team_members_path.should be_denied_for :user }
it { admin_team_members_path.should be_denied_for :visitor }
end
describe "GET /admin/emails" do
it { admin_emails_path.should be_allowed_for :admin }
it { admin_emails_path.should be_denied_for :user }
it { admin_emails_path.should be_denied_for :visitor }
end
end
require 'spec_helper'
describe "Issues" do
let(:project) { Factory :project }
let!(:commit) { project.repo.commits.first }
before do
login_as :user
project.add_access(@user, :read, :write)
end
describe "add new note", :js => true do
before do
visit project_commit_path(project, commit)
click_link "Comments" # notes tab
fill_in "note_note", :with => "I commented this commit"
click_button "Add note"
end
it "should conatin new note" do
page.should have_content("I commented this commit")
end
end
end
require 'spec_helper'
describe "Commits" do
let(:project) { Factory :project }
let!(:commit) { project.repo.commits.first }
before do
login_as :user
project.add_access(@user, :read)
end
describe "GET /commits" do
before do
visit project_commits_path(project)
end
it "should have valid path" do
current_path.should == project_commits_path(project)
end
it "should have project name" do
page.should have_content(project.name)
end
it "should list commits" do
page.should have_content(commit.author)
page.should have_content(commit.message)
end
end
describe "GET /commits/:id" do
before do
visit project_commit_path(project, commit)
end
it "should have valid path" do
current_path.should == project_commit_path(project, commit)
end
end
end
require 'spec_helper'
describe "Issues" do
let(:project) { Factory :project }
before do
login_as :user
project.add_access(@user, :read, :write)
@issue = Factory :issue,
:author => @user,
:assignee => @user,
:project => project
end
describe "add new note", :js => true do
before do
visit project_issue_path(project, @issue)
fill_in "note_note", :with => "I commented this issue"
click_button "Add note"
end
it "should conatin new note" do
page.should have_content("I commented this issue")
end
end
end
require 'spec_helper'
describe "Issues" do
let(:project) { Factory :project }
before do
login_as :user
project.add_access(@user, :read, :write)
end
describe "GET /issues" do
before do
@issue = Factory :issue,
:author => @user,
:assignee => @user,
:project => project
visit project_issues_path(project)
end
subject { page }
it { should have_content(@issue.title) }
it { should have_content(@issue.project.name) }
it { should have_content(@issue.assignee.name) }
describe "Destroy" do
before do
# admin access to remove issue
@user.users_projects.destroy_all
project.add_access(@user, :read, :write, :admin)
visit project_issues_path(project)
end
it "should remove entry" do
expect {
click_link "destroy_issue_#{@issue.id}"
}.to change { Issue.count }.by(-1)
end
end
describe "statuses", :js => true do
before do
@closed_issue = Factory :issue,
:author => @user,
:assignee => @user,
:project => project,
:closed => true
end
it "should show only open" do
should have_content(@issue.title)
should have_no_content(@closed_issue.title)
end
it "should show only closed" do
choose "closed_issues"
should have_no_content(@issue.title)
should have_content(@closed_issue.title)
end
it "should show all" do
choose "all_issues"
should have_content(@issue.title)
should have_content(@closed_issue.title)
end
end
end
describe "New issue", :js => true do
before do
visit project_issues_path(project)
click_link "New Issue"
end
it "should open new issue popup" do
page.should have_content("Add new issue")
end
describe "fill in" do
before do
fill_in "issue_title", :with => "bug 345"
fill_in "issue_content", :with => "app bug 345"
click_link "Select user"
click_link @user.name
end
it { expect { click_button "Save" }.to change {Issue.count}.by(1) }
it "should add new issue to table" do
click_button "Save"
page.should_not have_content("Add new issue")
page.should have_content @user.name
page.should have_content "bug 345"
page.should have_content project.name
end
it "should call send mail" do
Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true))
click_button "Save"
end
it "should send valid email to user with email & password" do
click_button "Save"
issue = Issue.last
email = ActionMailer::Base.deliveries.last
email.subject.should have_content("New Issue was created")
email.body.should have_content(issue.title)
email.body.should have_content(issue.assignee.name)
end
end
end
describe "Edit issue", :js => true do
before do
@issue = Factory :issue,
:author => @user,
:assignee => @user,
:project => project
visit project_issues_path(project)
click_link "Edit"
end
it "should open new issue popup" do
page.should have_content("Issue ##{@issue.id}")
end
describe "fill in" do
before do
fill_in "issue_title", :with => "bug 345"
fill_in "issue_content", :with => "app bug 345"
end
it { expect { click_button "Save" }.to_not change {Issue.count} }
it "should update issue fields" do
click_button "Save"
page.should_not have_content("Issue ##{@issue.id}")
page.should have_content @user.name
page.should have_content "bug 345"
page.should have_content project.name
end
end
end
end
require 'spec_helper'
describe "Issues" do
before do
login_as :user
end
describe "GET /keys" do
before do
@key = Factory :key, :user => @user
visit keys_path
end
subject { page }
it { should have_content(@key.title) }
describe "Destroy" do
it "should remove entry" do
expect {
click_link "destroy_key_#{@key.id}"
}.to change { @user.keys.count }.by(-1)
end
end
end
describe "New key", :js => true do
before do
visit keys_path
click_link "Add new"
end
it "should open new key popup" do
page.should have_content("Add new public key")
end
describe "fill in" do
before do
fill_in "key_title", :with => "laptop"
fill_in "key_key", :with => "publickey234="
end
it { expect { click_button "Save" }.to change {Key.count}.by(1) }
it "should add new key to table" do
click_button "Save"
page.should_not have_content("Add new public key")
page.should have_content "laptop"
page.should have_content "publickey234="
end
end
end
end
require 'spec_helper'
describe "Profile" do
before do
login_as :user
end
describe "Show profile" do
before do
visit profile_path
end
it { page.should have_content(@user.name) }
it { page.should have_content(@user.email) }
end
describe "Password update" do
before do
visit profile_password_path
end
it { page.should have_content("Password") }
it { page.should have_content("Password confirmation") }
describe "change password" do
before do
@old_pwd = @user.encrypted_password
fill_in "user_password", :with => "777777"
fill_in "user_password_confirmation", :with => "777777"
click_button "Save"
@user.reload
end
it "should redirect to signin page" do
current_path.should == new_user_session_path
end
it "should change password" do
@user.encrypted_password.should_not == @old_pwd
end
describe "login with new password" do
before do
fill_in "user_email", :with => @user.email
fill_in "user_password", :with => "777777"
click_button "Sign in"
end
it "should login user" do
current_path.should == root_path
end
end
end
end
end
require 'spec_helper'
describe "Projects" do
describe "GET /projects" do
it { projects_path.should be_allowed_for :admin }
it { projects_path.should be_allowed_for :user }
it { projects_path.should be_denied_for :visitor }
end
describe "GET /projects/new" do
it { projects_path.should be_allowed_for :admin }
it { projects_path.should be_allowed_for :user }
it { projects_path.should be_denied_for :visitor }
end
describe "Project" do
before do
@project = Factory :project
@u1 = Factory :user
@u2 = Factory :user
@u3 = Factory :user
# full access
@project.users_projects.create(:user => @u1, :read => true, :write => true, :admin => true)
# no access
@project.users_projects.create(:user => @u2, :read => false, :write => false, :admin => false)
# readonly
@project.users_projects.create(:user => @u3, :read => true, :write => false, :admin => false)
end
describe "GET /project_code" do
it { project_path(@project).should be_allowed_for @u1 }
it { project_path(@project).should be_allowed_for @u3 }
it { project_path(@project).should be_denied_for :admin }
it { project_path(@project).should be_denied_for @u2 }
it { project_path(@project).should be_denied_for :user }
it { project_path(@project).should be_denied_for :visitor }
end
describe "GET /project_code/tree" do
it { tree_project_path(@project).should be_allowed_for @u1 }
it { tree_project_path(@project).should be_allowed_for @u3 }
it { tree_project_path(@project).should be_denied_for :admin }
it { tree_project_path(@project).should be_denied_for @u2 }
it { tree_project_path(@project).should be_denied_for :user }
it { tree_project_path(@project).should be_denied_for :visitor }
end
describe "GET /project_code/commits" do
it { project_commits_path(@project).should be_allowed_for @u1 }
it { project_commits_path(@project).should be_allowed_for @u3 }
it { project_commits_path(@project).should be_denied_for :admin }
it { project_commits_path(@project).should be_denied_for @u2 }
it { project_commits_path(@project).should be_denied_for :user }
it { project_commits_path(@project).should be_denied_for :visitor }
end
describe "GET /project_code/commit" do
it { project_commit_path(@project, @project.commit).should be_allowed_for @u1 }
it { project_commit_path(@project, @project.commit).should be_allowed_for @u3 }
it { project_commit_path(@project, @project.commit).should be_denied_for :admin }
it { project_commit_path(@project, @project.commit).should be_denied_for @u2 }
it { project_commit_path(@project, @project.commit).should be_denied_for :user }
it { project_commit_path(@project, @project.commit).should be_denied_for :visitor }
end
describe "GET /project_code/team" do
it { team_project_path(@project).should be_allowed_for @u1 }
it { team_project_path(@project).should be_allowed_for @u3 }
it { team_project_path(@project).should be_denied_for :admin }
it { team_project_path(@project).should be_denied_for @u2 }
it { team_project_path(@project).should be_denied_for :user }
it { team_project_path(@project).should be_denied_for :visitor }
end
describe "GET /project_code/wall" do
it { wall_project_path(@project).should be_allowed_for @u1 }
it { wall_project_path(@project).should be_allowed_for @u3 }
it { wall_project_path(@project).should be_denied_for :admin }
it { wall_project_path(@project).should be_denied_for @u2 }
it { wall_project_path(@project).should be_denied_for :user }
it { wall_project_path(@project).should be_denied_for :visitor }
end
describe "GET /project_code/blob" do
it { blob_project_path(@project).should be_allowed_for @u1 }
it { blob_project_path(@project).should be_allowed_for @u3 }
it { blob_project_path(@project).should be_denied_for :admin }
it { blob_project_path(@project).should be_denied_for @u2 }
it { blob_project_path(@project).should be_denied_for :user }
it { blob_project_path(@project).should be_denied_for :visitor }
end
describe "GET /project_code/edit" do
it { edit_project_path(@project).should be_allowed_for @u1 }
it { edit_project_path(@project).should be_denied_for @u3 }
it { edit_project_path(@project).should be_denied_for :admin }
it { edit_project_path(@project).should be_denied_for @u2 }
it { edit_project_path(@project).should be_denied_for :user }
it { edit_project_path(@project).should be_denied_for :visitor }
end
describe "GET /project_code/issues" do
it { project_issues_path(@project).should be_allowed_for @u1 }
it { project_issues_path(@project).should be_allowed_for @u3 }
it { project_issues_path(@project).should be_denied_for :admin }
it { project_issues_path(@project).should be_denied_for @u2 }
it { project_issues_path(@project).should be_denied_for :user }
it { project_issues_path(@project).should be_denied_for :visitor }
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment