diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9f1a28f --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 \ No newline at end of file diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..fcdb2e1 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +4.0.0 diff --git a/Gemfile b/Gemfile index 7445e50..8b4b7c3 100644 --- a/Gemfile +++ b/Gemfile @@ -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 \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 3dadb77..7efd843 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,46 +1,79 @@ 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 @@ -48,7 +81,10 @@ PLATFORMS 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 diff --git a/spec/benchwarmer_spec.rb b/spec/benchwarmer_spec.rb index 33b739d..7599bec 100644 --- a/spec/benchwarmer_spec.rb +++ b/spec/benchwarmer_spec.rb @@ -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