Struct mrusty::Spec
[−]
[src]
pub struct Spec { // some fields omitted }
A struct
useful for mruby spec definition and running.
Available matchers:
be_a
,be_an
- type testingbe_<somehow>
- test boolean-returning<name>?
methodsbe <
,be <=
,be >
,be >=
- test relationbe_eq
,be_eql
,be_equal
- test equalitybe_falsey
- test falsey thingsbe_truthy
- test truthy thingshave_<something>
- test boolean-returninghas_<name>?
methodsraise_error
- test errorsrespond_to
- test method respondingbe_within(value).of
- test value
Examples
struct Cont; impl MrubyFile for Cont { fn require(mruby: MrubyType) { mruby.def_class_for::<Cont>("Container"); } } let mruby = Mruby::new(); Cont::require(mruby.clone()); let spec = Spec::new(mruby, "Container", " context 'when 1' do subject { 1 } it { is_expected.to eql 1 } end context 'when 1' do subject { 1 } let(:one) { 1 } it 'won\\'t' do expect(1).to eql one end end "); assert_eq!(spec.run(), true);
Methods
impl Spec
[src]
fn new(mruby: MrubyType, name: &str, script: &str) -> Spec
Creates an mruby spec runner.
Examples
struct Cont; impl MrubyFile for Cont { fn require(mruby: MrubyType) { mruby.def_class_for::<Cont>("Container"); } } let mruby = Mruby::new(); Cont::require(mruby.clone()); let spec = Spec::new(mruby, "Container", " context 'when 1' do subject { 1 } it { is_expected.to eql 1 } end context 'when 1' do subject { 1 } let(:one) { 1 } it 'won\\'t' do expect(1).to eql one end end ");
fn run(&self) -> bool
Runs mruby specs.
Examples
struct Cont; impl MrubyFile for Cont { fn require(mruby: MrubyType) { mruby.def_class_for::<Cont>("Container"); } } let mruby = Mruby::new(); Cont::require(mruby.clone()); let spec = Spec::new(mruby, "Container", " context 'when 1' do subject { 1 } it { is_expected.to eql 1 } end context 'when 1' do subject { 1 } let(:one) { 1 } it 'won\\'t' do expect(1).to eql one end end "); assert_eq!(spec.run(), true);