Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: RSpec

on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true

- name: Run RSpec
run: bundle exec rspec
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.0
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
source "http://rubygems.org"
source "https://rubygems.org"

group :development do
gem "bundler", ">= 1.0.0"
gem 'fakeweb'
gem 'guard-rspec'
gem "jeweler", ">= 1.8.3"
gem "rspec", ">= 2.8.0"
gem "simplecov"
end
gem "fakeweb"
gem "xmlrpc"
gem "jeweler", ">= 2.0"
gem "rspec", "~> 3.13"
gem "simplecov"
end
86 changes: 61 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,54 +1,90 @@
GEM
remote: http://rubygems.org/
remote: https://rubygems.org/
specs:
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
diff-lcs (1.1.3)
addressable (2.9.0)
public_suffix (>= 2.0.2, < 8.0)
builder (3.3.0)
diff-lcs (1.6.2)
fakeweb (1.3.0)
ffi (1.0.11)
faraday (0.7.6)
addressable (~> 2.2)
multipart-post (~> 1.1)
rack (~> 1.1)
git (1.13.0)
addressable (~> 2.8)
rchardet (~> 1.8)
guard (1.0.0)
ffi (>= 0.5.0)
thor (~> 0.14.6)
guard-rspec (0.6.0)
guard (>= 0.10.0)
jeweler (1.8.3)
bundler (~> 1.0)
github_api (0.4.10)
faraday (~> 0.7.6)
hashie (~> 1.2.0)
multi_json (~> 1.0)
oauth2 (~> 0.5.2)
hashie (1.2.0)
highline (3.1.2)
reline
io-console (0.8.2)
jeweler (2.1.1)
builder
bundler (>= 1.0)
git (>= 1.2.5)
github_api
highline (>= 1.6.15)
nokogiri (>= 1.5.10)
rake
rdoc
semver
mini_portile2 (2.8.9)
multi_json (1.0.4)
multipart-post (1.2.0)
nokogiri (1.19.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
oauth2 (0.5.2)
faraday (~> 0.7)
multi_json (~> 1.0)
psych (5.1.2)
stringio
public_suffix (5.0.1)
public_suffix (7.0.5)
racc (1.8.1)
rack (1.6.13)
rake (0.9.2.2)
rchardet (1.8.0)
rdoc (6.6.3.1)
psych (>= 4.0.0)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
reline (0.6.3)
io-console (~> 0.5)
rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.8)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.7)
semver (1.0.1)
simplecov (0.5.4)
multi_json (~> 1.0.3)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
stringio (3.1.0)
thor (0.14.6)
webrick (1.9.2)
xmlrpc (0.3.3)
webrick

PLATFORMS
ruby

DEPENDENCIES
bundler (>= 1.0.0)
fakeweb
guard-rspec
jeweler (>= 1.8.3)
rspec (>= 2.8.0)
jeweler (>= 2.0)
rspec (~> 3.13)
simplecov
xmlrpc

BUNDLED WITH
4.0.10
25 changes: 13 additions & 12 deletions spec/benchwarmer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,35 @@ module Benchwarmer
describe API do

it "requires an API token on initialization" do
expect {Benchwarmer::API.new}.should raise_error(ArgumentError)
expect {Benchwarmer::API.new}.to raise_error(ArgumentError)
end

it "also accepts config options on initialization" do
expect {Benchwarmer::API.new('api_token', {:secure => true})}.should_not raise_error(ArgumentError)
expect {Benchwarmer::API.new('api_token', {:secure => true})}.not_to raise_error
end

it "requires a username and password for class methods" do
expect {Benchwarmer::API.login('password')}.should raise_error(ArgumentError)
expect {Benchwarmer::API.token_get('password')}.should raise_error(ArgumentError)
expect {Benchwarmer::API.token_add('password')}.should raise_error(ArgumentError)
expect {Benchwarmer::API.token_delete('password')}.should raise_error(ArgumentError)
expect {Benchwarmer::API.login('password')}.to raise_error(ArgumentError)
expect {Benchwarmer::API.token_get('password')}.to raise_error(ArgumentError)
expect {Benchwarmer::API.token_add('password')}.to raise_error(ArgumentError)
expect {Benchwarmer::API.token_delete('password')}.to raise_error(ArgumentError)
end

it "requires a token to delete" do
expect {Benchwarmer::API.token_delete('username', 'password')}.should raise_error(ArgumentError)
expect {Benchwarmer::API.token_delete('username', 'password')}.to raise_error(ArgumentError)
end

it "also accepts config options on class methods" do
expect {Benchwarmer::API.login('username', 'password', {:secure => true})}.should_not raise_error(ArgumentError)
expect {Benchwarmer::API.token_get('username', 'password', {:secure => true})}.should_not raise_error(ArgumentError)
expect {Benchwarmer::API.token_add('username', 'password', {:secure => true})}.should_not raise_error(ArgumentError)
expect {Benchwarmer::API.token_delete('username', 'password', 'token', {:secure => true})}.should_not raise_error(ArgumentError)
allow_any_instance_of(XMLRPC::Client).to receive(:call).and_return(nil)
expect {Benchwarmer::API.login('username', 'password', {:secure => true})}.not_to raise_error
expect {Benchwarmer::API.token_get('username', 'password', {:secure => true})}.not_to raise_error
expect {Benchwarmer::API.token_add('username', 'password', {:secure => true})}.not_to raise_error
expect {Benchwarmer::API.token_delete('username', 'password', 'token', {:secure => true})}.not_to raise_error
end

describe 'Accept-Encoding header' do
shared_examples_for 'set Accept-Encoding: identity' do
it { subject.http_header_extra["accept-encoding"].should eq "identity" }
it { expect(subject.http_header_extra["accept-encoding"]).to eq "identity" }
end

it_behaves_like 'set Accept-Encoding: identity' do
Expand Down
Loading