0.0
No commit activity in last 3 years
No release in over 3 years
An extension of Ariete for RSpec.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 10.0

Runtime

~> 1.0.3
~> 3.0
 Project Readme

ariete-rspec

An extension of Ariete for RSpec. You can test standard output with RSpec custom matchers, eg. be_output, be_output_to_stderr.

Requirement

  • Ruby 2.0 or hight
  • RSpec 3

Installation

$ (sudo) gem install 'ariete-rspec'

Usage

klass.rb

class Klass
  class << self
    def output_out
      puts "Ariete is a kind of rabbit."
    end

    def output_err
      warn "Ariete means 'Lop' in Italian."
    end
  end
end

klass_spec.rb

require "ariete-rspec"
require_relative "klass"

RSpec.describe Klass do
  # Ariete extends matchers of RSpec.
  # Therefore, you can use 'be_output' and 'be_output_to_stderr'.
  describe ".output_out" do
    subject { Klass.method(:output_out).to_proc }
    it { is_expected.to be_output "Ariete is a kind of rabbit.\n" }
  end

  describe ".output_out (an alternate expression)" do
    subject { -> { Klass.output_out } }
    it { is_expected.to be_output "Ariete is a kind of rabbit.\n" }
  end

  describe ".output_err" do
    subject { Klass.method(:output_err).to_proc }
    it { is_expected.to be_output_to_stderr "Ariete means 'Lop' in Italian.\n" }
  end

  describe ".output_err (an alternate expression)" do
    subject { -> { Klass.output_err } }
    it { is_expected.to be_output_to_stderr "Ariete means 'Lop' in Italian.\n" }
  end
end

License

MIT License

Contributing

  1. Fork it ( https://github.com/mozamimy/ariete-rspec/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request