Skip to content
Open
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
The Kalibro Client gem abstracts communication with all the services in the Mezuro
platform, with an uniform Ruby API.

## Unreleased

- Add language field to KalibroConfiguration

## v4.0.0 - 30/03/2016
- Extract HTTP request handling code to the Likeno gem (https://github.com/mezuro/likeno)
- Refactor MetricCollector and MetricCollectoDetails finding methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module KalibroClient
module Entities
module Configurations
class KalibroConfiguration < KalibroClient::Entities::Configurations::Base
attr_accessor :id, :name, :description
attr_accessor :id, :name, :description, :language

def id=(value)
@id = value.to_i
Expand Down
8 changes: 8 additions & 0 deletions spec/entities/configurations/kalibro_configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
require 'spec_helper'

describe KalibroClient::Entities::Configurations::KalibroConfiguration do
describe 'accessors' do
[:name, :description, :language].each do |attr|
it 'should have accessors for the #{attr} attribute' do
expect(subject).to have_attr_accessor(attr)
end
end
end

describe 'id=' do
it 'should set the value of the attribute id as an Integer' do
subject.id = "42"
Expand Down
2 changes: 2 additions & 0 deletions spec/factories/kalibro_configurations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
factory :kalibro_configuration, class: KalibroClient::Entities::Configurations::KalibroConfiguration do
name "Java"
description "Code metrics for Java."
language "Java"

trait :with_id do
id 1
Expand All @@ -30,5 +31,6 @@
id 12
name "Perl"
description "Code metrics for Perl."
language "Java"
end
end
36 changes: 20 additions & 16 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require rails_helper` which will cause this
# file to always be loaded, without a need to explicitly require it in any files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, make a
# separate helper file that requires this one and then use it only in the specs
# that actually need it.
#
# The `.rspec` file also contains a few flags that are not defaults but that
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration

require 'mocha/api'

# Test coverage report
Expand All @@ -38,22 +55,6 @@
require 'factory_girl'
FactoryGirl.find_definitions

# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require rails_helper` which will cause this
# file to always be loaded, without a need to explicitly require it in any files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, make a
# separate helper file that requires this one and then use it only in the specs
# that actually need it.
#
# The `.rspec` file also contains a few flags that are not defaults but that
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
Expand Down Expand Up @@ -106,3 +107,6 @@
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :mocha
end

# Load support files (for now just matchers)
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f }
18 changes: 18 additions & 0 deletions spec/support/matchers/have_attr_accessor_matcher.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
RSpec::Matchers.define :have_attr_accessor do |field|
match do |object_instance|
object_instance.respond_to?(field) &&
object_instance.respond_to?("#{field}=")
end

failure_message do |object_instance|
"expected attr_accessor for #{field} on #{object_instance}"
end

failure_message_when_negated do |object_instance|
"expected attr_accessor for #{field} not to be defined on #{object_instance}"
end

description do
"assert there is an attr_accessor of the given name on the supplied object"
end
end