8000 add failing test for key? not responding to methods · inntran/github-metadata@c713154 · GitHub
[go: up one dir, main page]

Skip to content

Commit c713154

Browse files
committed
add failing test for key? not responding to methods
1 parent a88c865 commit c713154

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

spec/metadata_drop_spec.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,53 @@
5050
expect(payload.keys).to match_array(expected_values.keys)
5151
end
5252
end
53+
54+
context "returning values" do
55+
context "native methods" do
56+
it "returns a value via #[]" do
57+
expect(subject["url"]).to eql("http://jekyll.github.io/github-metadata")
58+
end
59+
60+
it "returns a value via #invoke_drop" do
61+
expect(subject.invoke_drop("url")).to eql("http://jekyll.github.io/github-metadata")
62+
end
63+
64+
it "responds to #key?" do
65+
expect(subject.key?("url")).to be_truthy
66+
end
67+
end
68+
69+
context "with mutated values" do
70+
before { subject["url"] = "foo" }
71+
72+
it "returns the mutated value via #[]" do
73+
expect(subject["url"]).to eql("foo")
74+
end
75+
76+
it "returns the mutated via #invoke_drop" do
77+
expect(subject.invoke_drop("url")).to eql("foo")
78+
end
79+
80+
it "responds to #key?" do
81+
expect(subject.key?("url")).to be_truthy
82+
end
83+
end
84+
85+
context "with fallback data" do
86+
let(:fallback_data) { { "foo" => "bar" } }
87+
before { subject.instance_variable_set("@fallback_data", fallback_data) }
88+
89+
it "returns the mutated value via #[]" do
90+
expect(subject["foo"]).to eql("bar")
91+
end
92+
93+
it "returns the mutated via #invoke_drop" do
94+
expect(subject.invoke_drop("foo")).to eql("bar")
95+
end
96+
97+
it "responds to #key?" do
98+
expect(subject.key?("foo")).to be_truthy
99+
end
100+
end
101+
end
53102
end

0 commit comments

Comments
 (0)
0