Increased test coverage
This commit is contained in:
parent
e9be4b375b
commit
f614ae8ef7
7 changed files with 84 additions and 42 deletions
|
@ -22,4 +22,12 @@ describe Group do
|
|||
it { should validate_presence_of :path }
|
||||
it { should validate_uniqueness_of(:path) }
|
||||
it { should validate_presence_of :owner }
|
||||
|
||||
describe :users do
|
||||
it { group.users.should == [] }
|
||||
end
|
||||
|
||||
describe :human_name do
|
||||
it { group.human_name.should == group.name }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,4 +32,46 @@ describe Namespace do
|
|||
it { should respond_to(:human_name) }
|
||||
it { should respond_to(:to_param) }
|
||||
end
|
||||
|
||||
it { Namespace.global_id.should == 'GLN' }
|
||||
|
||||
describe :to_param do
|
||||
it { namespace.to_param.should == namespace.path }
|
||||
end
|
||||
|
||||
describe :human_name do
|
||||
it { namespace.human_name.should == namespace.owner_name }
|
||||
end
|
||||
|
||||
describe :search do
|
||||
before do
|
||||
@namespace = create :namespace
|
||||
end
|
||||
|
||||
it { Namespace.search(@namespace.path).should == [@namespace] }
|
||||
it { Namespace.search('unknown').should == [] }
|
||||
end
|
||||
|
||||
describe :move_dir do
|
||||
before do
|
||||
@namespace = create :namespace
|
||||
end
|
||||
|
||||
it "should raise error when called directly" do
|
||||
expect { @namespace.move_dir }.to raise_error("Already exists")
|
||||
end
|
||||
|
||||
it "should move dir if path changed" do
|
||||
new_path = @namespace.path + "_new"
|
||||
@namespace.stub(path_was: @namespace.path)
|
||||
@namespace.stub(path: new_path)
|
||||
@namespace.move_dir.should be_true
|
||||
end
|
||||
end
|
||||
|
||||
describe :rm_dir do
|
||||
it "should remove dir" do
|
||||
namespace.rm_dir.should be_true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue