spec/bricks/bricks_spec.rb in gooddata-0.6.49 vs spec/bricks/bricks_spec.rb in gooddata-0.6.50
- old
+ new
@@ -1,32 +1,33 @@
# encoding: UTF-8
#
-# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
+# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
require 'gooddata/bricks/brick'
require 'gooddata/bricks/bricks'
require 'gooddata/bricks/middleware/base_middleware'
-require 'pry'
describe GoodData::Bricks do
it "Has GoodData::Bricks::Brick class" do
- GoodData::Bricks::Brick.should_not == nil
+ GoodData::Bricks::Brick.should_not be(nil)
end
it "should be possible to use block as an app in pipeline" do
p = GoodData::Bricks::Pipeline.prepare([
- lambda { |params| puts "x" }
+ lambda do |_params|
+ puts "x"
+ end
])
p.call({})
end
describe "#load_defaults" do
context "when you define a middleware with default_loaded_call and give it some defaults file with prefix" do
class TestMiddleWare < GoodData::Bricks::Middleware
- def initialize(options={})
+ def initialize(options = {})
@config = 'spec/bricks/default-config.json'
super(options)
end
def call(params)
@@ -53,11 +54,11 @@
p = GoodData::Bricks::Pipeline.prepare([
TestMiddleWare,
TestBrick
])
- res = p.call({
+ res = p.call(
'config' => {
'my' => {
'namespace' => {
'key' => 'redefined value',
'new_key' => 'new value'
@@ -65,13 +66,13 @@
},
'other_namespace' => {
'some_key' => 'some value'
}
}
- })
+ )
- res.should eq({
+ res.should eq(
'config' => {
'my' => {
'namespace' => {
'key' => 'redefined value',
'new_key' => 'new value',
@@ -81,32 +82,29 @@
'other_namespace' => {
'some_key' => 'some value'
}
},
"something_cool" => "redefined value and also default value 2"
- })
+ )
end
end
end
-
# TODO: Better test pre and post so we are sure it is executed in right order
it "should be possible to use instance both as middleware and app" do
-
class DummyMiddleware < GoodData::Bricks::Middleware
-
def call(params)
puts "pre"
app.call(params)
puts "post"
end
-
end
p = GoodData::Bricks::Pipeline.prepare([
DummyMiddleware.new,
- lambda { |params| puts "x" }
+ lambda do |_params|
+ puts "x"
+ end
])
p.call({})
end
-
end