• Stars
    star
    1
  • Language
    Ruby
  • License
    MIT License
  • Created about 6 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

RSpec matcher to check that an expression changed its result in arbitrary seconds

Rspec::BecomeMatcher Build Status

RSpec matcher to check that an expression changed its result within arbitrary seconds.

async_task.start!
expect { async_task.finished? }.to become(true)

Installation

Add this line to your application's Gemfile:

gem 'rspec-become-matcher'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec-become-matcher

Usage

Require and include matcher first:

require 'rspec/become_matcher'

RSpec.configure do |config|
  config.include RSpec::BecomeMatcher
end

Then, asynchronous behaviour can be tested like this:

# Start some asynchronous task
async_task.start!

# `become` matcher checks the task is `finished?` periodically
expect { async_task.finished? }.to become(true) # => PASS

# Start long asynchronous task
long_task.start!

# By default, `become` matcher waits 3 seconds
expect { long_task.finished? }.to become(true) # => FAIL

# Start long asynchronous task, which finishes in 5 seconds
another_long_task.start!

# Timeout seconds can be specified with `in`
expect { another_long_task.finished? }.to become(true).in(10) # => PASS

# Expectation can be specified with block
yet_another_long_task.start!
expect { yet_another_long_task }.to become { |task| task.finished? } # => PASS

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/fujimura/rspec-become-matcher. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant 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 Rspec::Become::Matcher project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

More Repositories

1

hi

Generate scaffold for a Haskell project
Haskell
202
star
2

git-gsub

A Git subcommand to do gsub in a repository
Go
72
star
3

houseman

A Haskell implementation of Foreman
Haskell
23
star
4

spot

spot
Haskell
20
star
5

wai-hspec-example

Example for wai + hspec
Haskell
15
star
6

git-freq

A Git subcommand to detect frequently changed code in the repository
Haskell
12
star
7

authentication

Authentication for minimalist
Ruby
10
star
8

token_attribute

Macro to generate unique random token attribute for ActiveRecord
Ruby
10
star
9

dotfiles

~/.
Vim Script
9
star
10

nippou

Ruby
6
star
11

purescript-react-example

PureScript + React.js example, based on https://github.com/purescript-contrib/purescript-react.
PureScript
6
star
12

fb_graph-rails

Ruby
4
star
13

rack-google_login

Minimalist login for rack app with Google account
Ruby
4
star
14

railsdm_2018_postgresql

Rails Developer Meetup 2018 Day 1「それPostgreSQLでできるよ」の発表資料とコード
TSQL
4
star
15

omniauth-google-oauth2-sample

omniauth-google-oauth2-sample
Ruby
3
star
16

skyptra

sinatra based skype bot
Ruby
3
star
17

rspec-something

Something expects one message in your example
Ruby
3
star
18

facebook-oauth2-example

Facebook OAuth2 Example in Haskell
Haskell
3
star
19

fb_graph-rails-example

example app for FbGraph::Rails
Ruby
3
star
20

hs-git-gsub

A Git subcommand to do gsub in a repository
Haskell
3
star
21

fizzbuzz

fizzbuzz
Haskell
2
star
22

yesod-basic

Haskell
2
star
23

google_chrome_open_hoogle

Open hoogle with context menu, with selected text
JavaScript
2
star
24

functional-stream-processing-meetup-sample

Haskell
2
star
25

speak_your_mind

rspec-like output for Shoulda/Test::Unit.
Ruby
1
star
26

chi

Generate scaffold for a Haskell project
Haskell
1
star
27

fujimura.github.com

fujimura.github.com
HTML
1
star
28

heisei_ruby_kaigi_01_simple_delegator

JavaScript
1
star
29

persistent-hspec-example

Haskell
1
star
30

s3

s3cmd wrapper in Haskell
Haskell
1
star
31

for_a_few_monads_more

Slides
Haskell
1
star
32

mongodb-query-builder

MongoDB Query Builder in Haskell
Haskell
1
star
33

hi-hspec

1
star
34

knob

Forked from https://hackage.haskell.org/package/knob
Haskell
1
star
35

mini_login

mini login
Ruby
1
star
36

philip

Write .cabal file in Haskell
Haskell
1
star
37

hi-example

Haskell
1
star
38

ghostwriter

Template engine server
JavaScript
1
star
39

hi-flat

1
star
40

chi-cli

Haskell
1
star