File: cache_store.rb

package info (click to toggle)
ruby-roadie 5.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 512 kB
  • sloc: ruby: 3,418; makefile: 5
file content (27 lines) | stat: -rw-r--r-- 829 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

shared_examples_for "roadie cache store" do
  it "allows storing Stylesheets" do
    stylesheet = Roadie::Stylesheet.new("foo.css", "body { color: green; }")
    expect(subject["foo"] = stylesheet).to eql stylesheet
  end

  it "allows retreiving stored stylesheets" do
    stylesheet = Roadie::Stylesheet.new("foo.css", "body { color: green; }")
    subject["foo"] = stylesheet
    stored_stylesheet = subject["foo"]
    expect(stored_stylesheet.to_s).to eq stylesheet.to_s
  end

  it "defaults to nil when cache does not contain path" do
    expect(subject["bar"]).to be_nil
  end

  it "accepts nil assignments to clear cache" do
    subject["foo"] = Roadie::Stylesheet.new("", "")
    expect {
      subject["foo"] = nil
    }.to_not raise_error
    expect(subject["foo"]).to be_nil
  end
end