|
50 | 50 | expect(payload.keys).to match_array(expected_values.keys)
|
51 | 51 | end
|
52 | 52 | 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 |
53 | 102 | end
|
0 commit comments