diff options
| author | Teddy Wing | 2017-06-14 18:24:17 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-06-14 18:24:17 +0200 | 
| commit | d2b1ab114348ee0895703cd650734f585b11e781 (patch) | |
| tree | dc90e30d2b828d8395f861b889e6e84b0026a661 /spec/helpers | |
| parent | 07c50e21b45b8fcf219410cbfb71f1c1e67e81b6 (diff) | |
| download | chouette-core-d2b1ab114348ee0895703cd650734f585b11e781.tar.bz2 | |
TableBuilderHelper::CustomLinks: Fix policy check for unhandled actions
In `#actions_after_policy_check`, we weren't correctly including actions
that weren't handled by the prior policy checks. Thus actions that
weren't [:delete, :edit, :archive, :unarchive] wouldn't get included in
the resulting list of actions.
Fix my logic error.
Refs #3479
Diffstat (limited to 'spec/helpers')
| -rw-r--r-- | spec/helpers/table_builder_helper/custom_links_spec.rb | 27 | 
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/helpers/table_builder_helper/custom_links_spec.rb b/spec/helpers/table_builder_helper/custom_links_spec.rb new file mode 100644 index 000000000..b64e97527 --- /dev/null +++ b/spec/helpers/table_builder_helper/custom_links_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe TableBuilderHelper::CustomLinks do +  describe "#actions_after_policy_check" do +    it "includes :show" do +      referential = build_stubbed(:referential) +      user_context = UserContext.new( +        build_stubbed( +          :user, +          organisation: referential.organisation, +          permissions: [ +            'boiv:read-offer' +          ] +        ), +        referential: referential +      ) + +      expect( +        TableBuilderHelper::CustomLinks.new( +          referential, +          user_context, +          [:show] +        ).actions_after_policy_check +      ).to eq([:show]) +    end +  end +end  | 
