Skip to content

Commit

Permalink
Add Registration::Addon.to_register
Browse files Browse the repository at this point in the history
Which will return the addons pending to be registered.
  • Loading branch information
dgdavid committed Jun 20, 2019
1 parent 1f26582 commit 16a1232
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/lib/registration/addon.rb
Expand Up @@ -71,6 +71,13 @@ def accepted
selected.reject(&:eula_refused?)
end

# Returns only those selected addons with accepted EULA but pending to be registered
#
# @return [Array<Addon>]
def to_register
accepted - registered
end

# return add-ons which are registered but not installed in the system
# and are available to install
# @return [Array<Addon>] the list of add-ons
Expand Down
8 changes: 4 additions & 4 deletions test/addon_spec.rb
Expand Up @@ -140,11 +140,11 @@
let(:registered) { Registration::Addon.new(addon_generator(params)) }
let(:not_selected) { Registration::Addon.new(addon_generator(params)) }
let(:available_addons) { [wo_eula, refused, accepted, registered, not_selected] }

let(:registration) { double(
get_addon_list: available_addons
let(:registration) do
double(
get_addon_list: available_addons
)
}
end

before do
available_addons.each(&:selected)
Expand Down

0 comments on commit 16a1232

Please sign in to comment.