summaryrefslogtreecommitdiff
path: root/spec/gitlab_keys_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/gitlab_keys_spec.rb')
-rw-r--r--spec/gitlab_keys_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/gitlab_keys_spec.rb b/spec/gitlab_keys_spec.rb
index e742712..aaaee15 100644
--- a/spec/gitlab_keys_spec.rb
+++ b/spec/gitlab_keys_spec.rb
@@ -82,6 +82,14 @@ describe GitlabKeys do
end
end
+ describe :stdin do
+ let(:gitlab_keys) { build_gitlab_keys }
+ subject { gitlab_keys.send :stdin }
+ before { $stdin = 1 }
+
+ it { should equal(1) }
+ end
+
describe :rm_key do
let(:gitlab_keys) { build_gitlab_keys('rm-key', 'key-741', 'ssh-rsa AAAAB3NzaDAxx2E') }
@@ -129,12 +137,24 @@ describe GitlabKeys do
gitlab_keys.exec
end
+ it 'batch-add-keys arg should execute batch_add_keys method' do
+ gitlab_keys = build_gitlab_keys('batch-add-keys')
+ gitlab_keys.should_receive(:batch_add_keys)
+ gitlab_keys.exec
+ end
+
it 'rm-key arg should execute rm_key method' do
gitlab_keys = build_gitlab_keys('rm-key')
gitlab_keys.should_receive(:rm_key)
gitlab_keys.exec
end
+ it 'clear arg should execute clear method' do
+ gitlab_keys = build_gitlab_keys('clear')
+ gitlab_keys.should_receive(:clear)
+ gitlab_keys.exec
+ end
+
it 'should puts message if unknown command arg' do
gitlab_keys = build_gitlab_keys('change-key')
gitlab_keys.should_receive(:puts).with('not allowed')