Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge into Sle 12 sp1 #23

Merged
merged 9 commits into from
May 31, 2016
Merged

Merge into Sle 12 sp1 #23

merged 9 commits into from
May 31, 2016

Conversation

teclator
Copy link
Contributor

@teclator teclator commented Feb 8, 2016

No description provided.

@imobachgs imobachgs mentioned this pull request Feb 8, 2016
#!/usr/bin/env rspec

require_relative "../test_helper"
require_relative "../../src/clients/firewall_auto.rb"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is problematic as requiring client cause its execution. So we usually avoid it. E.g. all mocking is not done during such run. For auto client I expect that without arguments it do nothing, but you should not rely on it. As e.g. with using https://github.com/yast/yast-yast2/blob/master/library/general/src/lib/installation/auto_client.rb#L60 new base class for auto clients it will raise exception.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw nasty workaround for it is using load File.expand_path("../../src/clients/firewall_auto.rb", __FILE__) instead of calling main.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jreidinger we will apply the nasty workaround for SP1, as we can change it for SP2.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then I really suggest to not use require_relative and instead use WFM.CallFunction https://github.com/yast/yast-ruby-bindings/blob/master/src/ruby/yast/wfm.rb#L164 with given parameters as it is much closer to expected usage. So instead of stubbing args you call expect(Yast::WFM.CallFunction("firewall_auto", ["Summary"])).to eq "Some summary"

@mvidner
Copy link
Member

mvidner commented Mar 18, 2016

btw nasty workaround for it is using load File.expand_path("../../src/clients/firewall_auto.rb", __FILE__) instead of calling main.

I don't know how that is supposed to help. main is executed anyway.

@mvidner
Copy link
Member

mvidner commented Mar 18, 2016

So I would drop commit d96edf3 and instead add a comment at the require

the client will be run which is bad in general but this one only complains in the log if func is not specified, so it is OK

@jreidinger
Copy link
Member

@mvidner

btw nasty workaround for it is using load File.expand_path("../../src/clients/firewall_auto.rb", FILE) instead of calling main.
I don't know how that is supposed to help. main is executed anyway.

Tricky part is that is it always executed, so you can do mock this and that and then load and in different scenario mock it in other way and call load

@mvidner
Copy link
Member

mvidner commented Mar 21, 2016

The tricky part is that is it always executed, so you can mock this and that and then load

OK, that could work, but in this case that is not done and I think it is not worth it.

@jreidinger
Copy link
Member

@teclator what is status here?

@teclator
Copy link
Contributor Author

@jreidinger it has not been lgmted yet, in that momment it should merged, @Imobach what do you think about?

@jreidinger
Copy link
Member

ok, so LGTM from me. it is always good to have tests :)

@teclator teclator merged commit d2334ac into yast:SLE-12-SP1 May 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants