Skip to content

Commit

Permalink
add rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
robinboening committed Oct 8, 2021
1 parent ae58325 commit 1b1fd09
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nftmaker_api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ Gem::Specification.new do |gem|

gem.add_dependency "oj", "~> 3.1"
gem.add_dependency "faraday", ">= 1", "< 2"

gem.add_development_dependency "rspec", "~> 3.10"
end
36 changes: 36 additions & 0 deletions spec/client_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require 'spec_helper'

describe NftmakerApi do
subject { described_class.new }

describe "configuration" do
it "has default settings" do
expect(subject.configuration.api_key).to eq nil
expect(subject.configuration.host).to eq "https://api.nft-maker.io"
expect(subject.configuration.http_adapter).to eq :net_http
end

it "allows to change settings" do
described_class.configure do |c|
c.api_key = "12345678"
c.host = "foobar.com"
c.http_adapter = :typhoeus
end

expect(subject.configuration.api_key).to eq "12345678"
expect(subject.configuration.host).to eq "foobar.com"
expect(subject.configuration.http_adapter).to eq :typhoeus
expect(subject.http_client.adapter).to eq Faraday::Adapter::Typhoeus
end

it "allows settings per instance" do
client_1 = described_class.new(host: "foo.com", api_key: "foo123")
expect(client_1.api_key).to eq "foo123"
expect(client_1.host).to eq "foo.com"

client_2 = described_class.new(host: "bar.com", api_key: "bar123")
expect(client_2.api_key).to eq "bar123"
expect(client_2.host).to eq "bar.com"
end
end
end
8 changes: 8 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'bundler/setup'
Bundler.setup

require 'nftmaker_api'

RSpec.configure do |config|
# some (optional) config here
end

0 comments on commit 1b1fd09

Please sign in to comment.