Individual test with rspec

Hi everybody,

I'm trying to do a single test into a battery of tests using rspec but I'm no having success.

When I edit the configuration of the single test (Run->Edit Configurations->RSpec) I check that the field 'Exaple Name' is 'DescribeTest.find' without a white space. I manually change the content of the field 'Example Name' to 'DescribeTest .find' with blank space and it passes the tests.

Here the used commands:

Working
rspec apache_values_dao_module_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example "ApacheValuesDao .find"

Not Working
rspec apache_values_dao_module_spec.rb --require teamcity/spec/runner/formatter/teamcity/formatter --format Spec::Runner::Formatter::TeamcityFormatter --example ApacheValuesDao.find

I use RubyMine 7.1.4 (last), RSpec 3.3.2 (last).

Is it a bug of RubyMine? Can I change something inside the IDE to fix this?

Thank you!

Juamna

5 comments
Comment actions Permalink

Hello!

Could you please attach your apache_values_dao_module_spec.rb? (at least, its part with the code in question)

0
Comment actions Permalink

Hello! and than you for your help!

Here is one of the tests that I am running:

context 'valid error_document_500' do
  it 'getter returns same that was seted' do

    error_document_500 = 'error500.html'
    expect(error_document_500).to receive(:kind_of?).once.with(FilePath).and_return(true)
    apache_values = ApacheConf::ConcreteConf::VirtualHost::GeneralValues::ApacheValues.new
    apache_values.set_error_document_500(error_document_500)
    expect(apache_values.get_error_document_500).to eql (error_document_500)

  end
end


But It happens with every test I execute, I cannot run ir individually, but if I run all the tests I can see the results...

Thank you again!

0
Comment actions Permalink

For provided code sample RubyMine creates run configuration with parameter
--example "valid error_document_500"

which runs only test scenarios with name prefix "valid error_document_500". So if you have another tests named like
"valid error_document_5000" or "valid error_document_500 check" they will be started too.

The question is - do you have tests that doesn't match to the prefix "valid error_document_500" but started even when option
    --example "valid error_document_500"
provided

0
Comment actions Permalink

Hello guys!

Actually you are giving me some light to this issue!

I have discovered I don't have problems with tests wich describe definition do not start with '#'...

context 'error_document_500 getters and setters' do

  context 'invalid error_document_500' do
    it 'raises exception' do

      test...

    end
  end
end


I have problems with the tests that the description of the describe starts with '#' like the aexample above:

describe '#is_valid?' do

  context 'domain, document_root, server_alias, suexec_user_group, tsunami and directory_index are nil' do
    it 'returns false' do
      apache_values = ApacheConf::ConcreteConf::VirtualHost::GeneralValues::ApacheValues.new
      expect(apache_values.is_valid?).to be_falsey
    end
  end
end


Does the character '#' makes the execution of the single test fail?

Thank you again!

0
Comment actions Permalink

I didn't find any specific meaning of symbol # when run rspec. But found another way to see several test started when you run only one.

 
describe '#is_valid?' do
  context 'domain, document_root, server_alias, suexec_user_group, tsunami and directory_index are nil' do
    it 'returns false' do

    end
  end
end

describe 'test#create_date' do
  context 'domain, document_root, server_alias, suexec_user_group, tsunami and directory_index are nil' do
    it 'should return update_date when #is_valid? false' do

    end
  end
end


In this example when you try to start describe '#is_valid?' both test would start.

The first test would start because describe contains the value and the second would start because it 'should return update_date when #is_valid? false' contains the value too

0

Please sign in to leave a comment.