Created
January 25, 2013 03:26
-
-
Save ktusznio/4631488 to your computer and use it in GitHub Desktop.
Break a big object up into smaller dependencies that are defined per context. This avoids redefining the big object for each context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe Foo do | |
let(:big_params) do | |
{ | |
foo: foo, | |
name: "name", | |
... | |
} | |
end | |
let(:foo) { nil } | |
context "case a" do | |
let(:foo) { :a } | |
it "test 1" do | |
big_params[:foo] # => :a | |
end | |
it "test 2" do | |
big_params[:foo] # => :a | |
end | |
end | |
context "case b" do | |
let(:foo) { :b } | |
it "test 1" do | |
big_params[:foo] # => :b | |
end | |
it "test 2" do | |
big_params[:foo] # => :b | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment