spec/cucumber/cli/options_spec.rb in cucumber-1.2.5 vs spec/cucumber/cli/options_spec.rb in cucumber-1.3.0

- old
+ new

@@ -121,29 +121,10 @@ end end context '-p PROFILE or --profile PROFILE' do - it "notifies the user that an individual profile is being used" do - given_cucumber_yml_defined_as({'foo' => [1,2,3]}) - options.parse!(%w{--profile foo}) - output_stream.string.should =~ /Using the foo profile...\n/ - end - - it "notifies the user when multiple profiles are being used" do - given_cucumber_yml_defined_as({'foo' => [1,2,3], 'bar' => ['v'], 'dog' => ['v']}) - options.parse!(%w{--profile foo --profile bar --profile dog}) - output_stream.string.should =~ /Using the foo, bar and dog profiles...\n/ - end - - it "notifies the user of all profiles being used, even when they are nested" do - given_cucumber_yml_defined_as('foo' => '-p bar', 'bar' => 'features') - after_parsing('-p foo') do - output_stream.string.should =~ /Using the foo and bar profiles.../ - end - end - it "uses the default profile passed in during initialization if none are specified by the user" do given_cucumber_yml_defined_as({'default' => '--require some_file'}) options = Options.new(output_stream, error_stream, :default_profile => 'default') options.parse!(%w{--format progress}) @@ -221,10 +202,29 @@ given_cucumber_yml_defined_as({'html' => %w[--format progress --format html -o features.html]}) options.parse!(%w{--profile html}) options[:formats].should == [['progress', output_stream], ['html', 'features.html']] end + it "only reads cucumber.yml once" do + original_parse_count = $cucumber_yml_read_count + $cucumber_yml_read_count = 0 + + begin + given_cucumber_yml_defined_as(<<-END + <% $cucumber_yml_read_count += 1 %> + default: --format pretty + END + ) + options = Options.new(output_stream, error_stream, :default_profile => 'default') + options.parse!(%w(-f progress)) + + $cucumber_yml_read_count.should == 1 + ensure + $cucumber_yml_read_count = original_parse_count + end + end + it "respects --quiet when defined in the profile" do given_cucumber_yml_defined_as('foo' => '-q') options.parse!(%w[-p foo]) options[:snippets].should be_false options[:source].should be_false @@ -287,9 +287,18 @@ it "does not mistake environment variables as feature paths" do after_parsing('my_feature.feature FOO=bar') do options[:paths].should == ['my_feature.feature'] end end + + context '--snippet-type' do + it "parses the snippet type argument" do + after_parsing('--snippet-type classic') do + options[:snippet_type].should eql :classic + end + end + end + end describe '#expanded_args_without_drb' do it "returns the orginal args in additon to the args from any profiles" do given_cucumber_yml_defined_as('foo' => '-v',