aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-06-08 14:37:44 +0200
committerTeddy Wing2017-06-08 14:37:44 +0200
commitebd01ff27d3a4b2a57566632ce37873de4acf810 (patch)
treef74e971080fe4d4ccf246872df8ff8bd101951b3
parent1ea3187de06cb159faf0f773c50263dd69eafaa8 (diff)
downloadchouette-core-ebd01ff27d3a4b2a57566632ce37873de4acf810.tar.bz2
TableBuilder spec: Stub a `params` global
Since the `TableBuilder` depends on the controller's `params` hash (the link builder needs the controller, action, etc. in order to build a link), we need to stub `params` in order for the helper call to work in our test. Still not a fan of this implicit dependency, but we'll see. I might keep it in because maybe it makes more sense and would require less change to keep it the way it is. The link builder is highly dynamic and seems like it would be tricky to make non-dynamic. Needs more thought. Refs #3479
-rw-r--r--spec/helpers/table_builder_helper_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/helpers/table_builder_helper_spec.rb b/spec/helpers/table_builder_helper_spec.rb
index e9d1afed3..085ed5a81 100644
--- a/spec/helpers/table_builder_helper_spec.rb
+++ b/spec/helpers/table_builder_helper_spec.rb
@@ -7,6 +7,12 @@ describe TableBuilderHelper, type: :helper do
build_stubbed(:referential)
]
+ allow(helper).to receive(:params).and_return({
+ :controller => 'workbenches',
+ :action => 'show',
+ :id => workbenches[0].workbench.id
+ })
+
expected = <<-HTML
<table class="table has-filter has-search">
<thead>