-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
42 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,18 +108,40 @@ class Test::Model < described_class | |
|
||
subject { model } | ||
|
||
it "behaves like a model" do | ||
expect(subject).to be_a klass | ||
expect(subject.email).to eq "[email protected]" | ||
end | ||
context "with kwargs" do | ||
let(:model) { klass.new(**options) } | ||
|
||
it "behaves like a model" do | ||
expect(subject).to be_a klass | ||
expect(subject.email).to eq "[email protected]" | ||
end | ||
|
||
it "injects options from the other model" do | ||
expect(subject.first_name).to eq "Joe" | ||
expect(subject.last_name).to eq "Doe" | ||
it "injects options from the other model" do | ||
expect(subject.first_name).to eq "Joe" | ||
expect(subject.last_name).to eq "Doe" | ||
end | ||
|
||
it "injects memoizers from the other model" do | ||
expect(subject.name).to eq "Joe Doe" | ||
end | ||
end | ||
|
||
it "injects memoizers from the other model" do | ||
expect(subject.name).to eq "Joe Doe" | ||
context "with hash argument" do | ||
let(:model) { klass.new(options) } | ||
|
||
it "behaves like a model" do | ||
expect(subject).to be_a klass | ||
expect(subject.email).to eq "[email protected]" | ||
end | ||
|
||
it "injects options from the other model" do | ||
expect(subject.first_name).to eq "Joe" | ||
expect(subject.last_name).to eq "Doe" | ||
end | ||
|
||
it "injects memoizers from the other model" do | ||
expect(subject.name).to eq "Joe Doe" | ||
end | ||
end | ||
|
||
context "with invalid options" do | ||
|