|  | 
| 2 | 2 | 
 | 
| 3 | 3 | RSpec.describe SqliteExtensions::UUID do | 
| 4 | 4 |   it "has a version" do | 
| 5 |  | -    expect(described_class::VERSION).to eq "1.0.1" | 
|  | 5 | +    expect(described_class::VERSION).to eq "1.0.2" | 
| 6 | 6 |   end | 
| 7 | 7 | 
 | 
| 8 | 8 |   describe "#to_path" do | 
|  | 9 | +    subject { described_class.to_path } | 
|  | 10 | + | 
| 9 | 11 |     before do | 
| 10 | 12 |       gemspec = instance_double(Gem::Specification, require_path: "foo") | 
| 11 | 13 |       allow(Gem).to receive(:loaded_specs).and_return("sqlite_extensions-uuid" => gemspec) | 
| 12 | 14 |     end | 
| 13 | 15 | 
 | 
| 14 |  | -    it "returns the path to the compiled extension" do | 
| 15 |  | -      path = described_class.to_path | 
|  | 16 | +    context "when linux" do | 
|  | 17 | +      before do | 
|  | 18 | +        allow(RbConfig::CONFIG).to receive(:fetch).with("DLEXT").and_return("so") | 
|  | 19 | +      end | 
|  | 20 | + | 
|  | 21 | +      it { is_expected.to eq "foo/sqlite_extensions/uuid/uuid.so" } | 
|  | 22 | +    end | 
|  | 23 | + | 
|  | 24 | +    context "when mac with .dylib extension" do | 
|  | 25 | +      before do | 
|  | 26 | +        allow(RbConfig::CONFIG).to receive(:fetch).with("DLEXT").and_return("dylib") | 
|  | 27 | +      end | 
|  | 28 | + | 
|  | 29 | +      it { is_expected.to eq "foo/sqlite_extensions/uuid/uuid.dylib" } | 
|  | 30 | +    end | 
|  | 31 | + | 
|  | 32 | +    context "when mac with .bundle extension" do | 
|  | 33 | +      before do | 
|  | 34 | +        allow(RbConfig::CONFIG).to receive(:fetch).with("DLEXT").and_return("bundle") | 
|  | 35 | +      end | 
| 16 | 36 | 
 | 
| 17 |  | -      expect(path).to eq "foo/sqlite_extensions/uuid/uuid" | 
|  | 37 | +      it { is_expected.to eq "foo/sqlite_extensions/uuid/uuid.bundle" } | 
| 18 | 38 |     end | 
| 19 | 39 |   end | 
| 20 | 40 | 
 | 
| 21 |  | -  it "has the correct gemspec info" do | 
|  | 41 | +  it "has the correct gemspec info" do # rubocop:disable RSpec/ExampleLength | 
| 22 | 42 |     path = File.expand_path("../../sqlite_extensions-uuid.gemspec", __dir__) | 
| 23 | 43 |     gemspec = Gem::Specification.load path | 
| 24 | 44 | 
 | 
| 25 | 45 |     expect(gemspec).to have_attributes( | 
| 26 | 46 |       name: "sqlite_extensions-uuid", | 
| 27 |  | -      version: Gem::Version.new("1.0.1"), | 
|  | 47 | +      version: Gem::Version.new("1.0.2"), | 
| 28 | 48 |       files: %w[ | 
| 29 | 49 |         ext/sqlite_extensions/uuid/extconf.rb | 
| 30 | 50 |         ext/sqlite_extensions/uuid/sqlite3.h | 
|  | 
| 35 | 55 |         lib/sqlite_extensions/uuid/version.rb | 
| 36 | 56 |       ], | 
| 37 | 57 |       licenses: ["MIT"], | 
| 38 |  | -      metadata: {}, | 
|  | 58 | +      metadata: { | 
|  | 59 | +        "allowed_push_host" => "https://rubygems.org", | 
|  | 60 | +        "changelog_uri" => "https://github.com/jethrodaniel/sqlite_extensions-uuid/blob/main/CHANGELOG.md", | 
|  | 61 | +        "homepage_uri" => "https://github.com/jethrodaniel/sqlite_extensions-uuid", | 
|  | 62 | +        "source_code_uri" => "https://github.com/jethrodaniel/sqlite_extensions-uuid" | 
|  | 63 | +      }, | 
| 39 | 64 |       required_ruby_version: Gem::Requirement.new([">= 3.0.0"]), | 
| 40 |  | -      summary: "SQLite's UUID v4 extension, packaged as a gem" | 
|  | 65 | +      summary: "SQLite's UUID v4 extension, packaged as a gem." | 
| 41 | 66 |     ) | 
| 42 | 67 |     require_paths = gemspec.require_paths | 
| 43 | 68 |     expect(require_paths.size).to eq 2 | 
| 44 |  | -    expect(require_paths.first).to end_with "sqlite_extensions-uuid-1.0.1" | 
|  | 69 | +    expect(require_paths.first).to end_with "sqlite_extensions-uuid-1.0.2" | 
| 45 | 70 |     expect(require_paths.last).to eq "lib" | 
| 46 | 71 |   end | 
| 47 | 72 | end | 
0 commit comments