diff options
| author | Teddy Wing | 2017-09-01 14:51:07 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-09-01 14:52:53 +0200 | 
| commit | 7f85e8bbb15ec4063dad8b080e61d690b77dead7 (patch) | |
| tree | b183000bb3e68134e4d77988ebc17c8d8d623b72 /spec/helpers | |
| parent | 9574d8b8351fd59eeada05a1ba71893a82b86989 (diff) | |
| download | chouette-core-7f85e8bbb15ec4063dad8b080e61d690b77dead7.tar.bz2 | |
TableBuilderHelper::Column: Add `#linkable?` method
This tells the markup assembler whether or not this column should be
wrapped in a link (`<a>`). It intends to serve the same purpose as
`TableBuilderHelper#column_is_linkable`, but at the column level. The
idea is to remove that method when these links only operate by column
and not by pre-defined values like before/now.
Diffstat (limited to 'spec/helpers')
| -rw-r--r-- | spec/helpers/table_builder_helper/column_spec.rb | 23 | 
1 files changed, 23 insertions, 0 deletions
| diff --git a/spec/helpers/table_builder_helper/column_spec.rb b/spec/helpers/table_builder_helper/column_spec.rb index 0c5c89e8a..e0bfd8a6a 100644 --- a/spec/helpers/table_builder_helper/column_spec.rb +++ b/spec/helpers/table_builder_helper/column_spec.rb @@ -21,6 +21,29 @@ describe TableBuilderHelper::Column do      end    end +  describe "#linkable?" do +    it "returns true if :link_to is not nil" do +      expect( +        TableBuilderHelper::Column.new( +          name: 'unused', +          attribute: nil, +          link_to: lambda do +            train.kind +          end +        ).linkable? +      ).to be true +    end + +    it "returns false if :link_to is nil" do +      expect( +        TableBuilderHelper::Column.new( +          name: 'unused', +          attribute: nil +        ).linkable? +      ).to be false +    end +  end +    describe "#link_to" do      it "calls the block passed in and returns the result" do        train = double('train', kind: 'TGV') | 
