aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-06-08 15:05:59 +0200
committerTeddy Wing2017-06-08 15:05:59 +0200
commit5166f0b6030b79d47b02743656eff835b523cae1 (patch)
tree8720369cd29a800680f9943508263bfc5226c51d
parentc4a5af98e48a51ebbca4e1eaad96da44887e8757 (diff)
downloadchouette-core-5166f0b6030b79d47b02743656eff835b523cae1.tar.bz2
TableBuilder spec: Stub `#model` on collection
`referentials` (known as `collection` in the `TableBuilder`) is supposed to be an `ActiveRecord::Relation` instance. The `#sortable_columns` method calls `collection.model` in order to dynamically build a table column header. In order to get the test to the next stage, stub the `#model` method. Not a huge fan. Ideally, the code wouldn't be so dynamic, but maybe I'm wrong about that. Still need to think about this for the refactoring. Refs #3479
-rw-r--r--spec/helpers/table_builder_helper_spec.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/spec/helpers/table_builder_helper_spec.rb b/spec/helpers/table_builder_helper_spec.rb
index 5ca23ad09..f3db493ce 100644
--- a/spec/helpers/table_builder_helper_spec.rb
+++ b/spec/helpers/table_builder_helper_spec.rb
@@ -3,11 +3,12 @@ require 'spec_helper'
describe TableBuilderHelper, type: :helper do
describe "#table_builder_2" do
it "builds a table" do
- # TODO: `sortable_columns` calls `#model` on this collection
referentials = [
build_stubbed(:referential)
]
+ allow(referentials).to receive(:model).and_return(Referential)
+
allow(helper).to receive(:params).and_return({
:controller => 'workbenches',
:action => 'show',