summaryrefslogtreecommitdiff
path: root/spec/gitlab_keys_spec.rb
diff options
context:
space:
mode:
authorGabor Nagy <mail@aigeruth.hu>2014-06-22 22:45:06 +0200
committerGabor Nagy <mail@aigeruth.hu>2014-06-23 20:52:45 +0200
commit32f1893298bc0108df89de0e543193af20bb0e7c (patch)
tree2fcff9cc992f4560be894f41938573ef3e6bb15e /spec/gitlab_keys_spec.rb
parentca425566d0266a1786019153757e283d7d246450 (diff)
downloadgitlab-shell-32f1893298bc0108df89de0e543193af20bb0e7c.tar.gz
Improve coverage.
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')