Project

cmdx-rspec

0.0
No release in over 3 years
Simple CMDx task testing via RSpec matchers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

>= 1.5.0
>= 0
 Project Readme

CMDx::RSpec Logo

Version Build License

CMDx::RSpec

Collection of RSpec matchers for CMDx.

Installation

Add this line to your application's Gemfile:

gem 'cmdx-rspec'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cmdx-rspec

Usage

have_been_success

Asserts that a CMDx task result indicates successful execution.

it "returns success" do
  result = SomeTask.execute

  expect(result).to have_been_success
end

have_been_skipped

Asserts that a CMDx task result indicates the task was skipped during execution.

it "returns skipped" do
  result = SomeTask.execute

  expect(result).to have_been_skipped
end

have_been_failure

Asserts that a CMDx task result indicates execution failure.

it "returns failure" do
  result = SomeTask.execute

  expect(result).to have_been_failure
end

have_empty_metadata

Asserts that a CMDx task result has no metadata.

it "returns empty metadata" do
  result = SomeTask.execute

  expect(result).to have_empty_metadata
end

have_matching_metadata

Asserts that a CMDx task result contains specific metadata.

it "returns matching metadata" do
  result = SomeTask.execute

  expect(result).to have_matching_metadata(status_code: 500)
end

have_empty_context

Asserts that a CMDx task result has no context data.

it "returns empty context" do
  result = SomeTask.execute

  expect(result).to have_empty_context
end

have_matching_context

Asserts that a CMDx task result contains specific context data.

it "returns matching context" do
  result = SomeTask.execute

  expect(result).to have_matching_context(stored_result: 123)
end

be_deprecated

Asserts that a CMDx task result indicates the task is deprecated.

it "returns deprecated" do
  result = SomeTask.execute

  expect(result).to be_deprecated
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/drexed/cmdx-rspec. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Cmdx::Rspec project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.