Comments (2)
This is a result of the fact that its
is basically a macro to define an internal "subject" such that you can set expectations on the value of an attribute. The exception is raised as part of the process of establishing that internal subject.
Part of me wants to say that its
is intended to only allow testing of attribute values and not arbitrary method behavior. I also cannot think of an elegant way to support this.
That said, we could define a method to support this kind of test, as follows:
def is_expected_as_block
expect { __its_subject }
end
That's pretty verbose, though, and not in line with anything else in rspec proper, so I'm a little reluctant to do it.
from rspec-its.
I understand and tend to agree with your reasoning that its
is only meant for attribute values and thus does not need exception testing.
Feel free to close this issue; the alternative (or actually the original) is just as good.
from rspec-its.
Related Issues (20)
- Option to deprecate `should` and `should_not` HOT 3
- The use of doubles or partial doubles from rspec-mocks outside of the per-test lifecycle is not supported. HOT 11
- Test failing due to change in RSpec's execution_result method HOT 2
- RSpec 3 is being released tomorrow HOT 1
- Accepting method arguments HOT 15
- It's not possible to focus on an `its` assertion. HOT 12
- deep hash support HOT 3
- Should use `Object#public_send` instead of `Object#send`. HOT 16
- described_class is changed when using its HOT 1
- Possible to mark "its" examples as pending? HOT 1
- are_expected undefined HOT 3
- Please update to compatible with RSpec 3.2 HOT 2
- Link to documentation from Rubygems is wrong HOT 8
- rspec-its breaking InSpec HOT 4
- its against BasicObject fails to generate description HOT 1
- its([:attr]) has the proper value, its(:attr) does not HOT 1
- When requiring the Ruby's timeout library I can no longer retrieve a nested attribute named timeout on an OpenStruct HOT 3
- irb: warn: can't alias context from irb_context. HOT 3
- Is using `its` still recommended? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspec-its.