Skip to content

Commit

Permalink
spec for client module[all covered]
Browse files Browse the repository at this point in the history
  • Loading branch information
jschmid1 committed Jul 2, 2014
1 parent a4eafaa commit da643a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/suse/connect/client.rb
Expand Up @@ -46,8 +46,8 @@ def register!
success_message
end

def success_message
puts "Registered #{@options[:product][:identifier]} #{@options[:product][:version]} #{@options[:product][:arch]}"
def print_success_message
puts "Registered #{@options[:product].identifier} #{@options[:product].version} #{@options[:product].arch}"
puts "Rooted at: #{@options[:filesystem_root]}" unless @options[:filesystem_root].nil?
puts "To server: #{@options[:url]}" unless @options[:url].nil?
puts "Using EMail: #{@options[:email]}" unless @options[:email].nil?
Expand Down
13 changes: 9 additions & 4 deletions spec/connect/client_spec.rb
Expand Up @@ -381,13 +381,18 @@

end

describe '#success_message' do
describe '#print_success_message' do

let(:stubbed_response) { 'Registered SLES 12 s390' }
let(:product) { SUSE::Connect::Zypper::Product.new name: 'SLES', version: 12, arch: 's390' }

subject { Client.new(url: 'http://dummy:42', email: 'asd@asd.de', product: product, filesystem_root: '/') }

it 'prints message on successful register' do
expect(subject).to receive(:success_message).and_return stubbed_response
subject.success_message
expect($stdout).to receive(:puts).with('Registered SLES 12 s390')
expect($stdout).to receive(:puts).with('To server: http://dummy:42')
expect($stdout).to receive(:puts).with('Using EMail: asd@asd.de')
expect($stdout).to receive(:puts).with('Rooted at: /')
subject.print_success_message
end
end

Expand Down

0 comments on commit da643a1

Please sign in to comment.