概要
rspec helper | define helper method int module
lower.rb
module Lower def lower(text) text.downcase end end
spec_helper.rb
require 'lower' RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus config.include Lower end
hige_spec.rb
require 'spec_helper' require 'hige' describe Hige do it "hige1" do expect("lower").to eq(lower("LOWER")) end end
テスト結果
$ rspec Run options: include {:focus=>true} All examples were filtered out; ignoring {:focus=>true} . Finished in 0.001 seconds 1 example, 0 failures