spec/lib/rambo_spec.rb in rambo_ruby-0.2.3 vs spec/lib/rambo_spec.rb in rambo_ruby-0.3.0

- old
+ new

@@ -9,17 +9,17 @@ describe ".generate_contract_tests!" do let(:valid_file) { "foobar.raml" } let(:default_options) { { rails: true } } before(:each) do - allow(Dir).to receive(:[]).and_return([valid_file]) + allow(Dir).to receive(:foreach).and_return("/Users/dscheider/rambo/doc/raml/#{valid_file}") end context "in all cases" do it "generates documents" do expect(Rambo::DocumentGenerator).to receive(:generate!).with(valid_file, default_options) - Rambo.generate_contract_tests!(valid_file, default_options) + Rambo.generate_contract_tests!(file: valid_file, options: default_options) end end context "when there is a .rambo.yml file" do before(:each) do @@ -47,40 +47,40 @@ context "rails option set to false in file" do it "sets rails option to false" do allow(Rambo).to receive(:yaml_options).and_return({ rails: false }) expect(Rambo::DocumentGenerator) .to receive(:generate!) - .with(File.expand_path("doc/raml/foobar.raml"), { rails: false }) + .with("/Users/dscheider/rambo/doc/raml/#{valid_file}", { rails: false }) Rambo.generate_contract_tests! end end context "rails option set to true in file" do it "sets rails option to true" do allow(Rambo).to receive(:yaml_options).and_return({ rails: true }) expect(Rambo::DocumentGenerator) .to receive(:generate!) - .with(File.expand_path("doc/raml/foobar.raml"), { rails: true }) + .with("/Users/dscheider/rambo/doc/raml/#{valid_file}", { rails: true }) Rambo.generate_contract_tests! end end context "rails option not set in file" do it "sets rails option to true" do allow(Rambo).to receive(:yaml_options).and_return({}) expect(Rambo::DocumentGenerator) .to receive(:generate!) - .with(File.expand_path("doc/raml/foobar.raml"), { rails: true }) + .with(File.expand_path("/Users/dscheider/rambo/doc/raml/#{valid_file}"), { rails: true }) Rambo.generate_contract_tests! end end end context "when there is no .rambo.yml file" do it "uses default options" do expect(Rambo::DocumentGenerator) .to receive(:generate!) - .with(File.expand_path("doc/raml/#{valid_file}"), default_options) + .with(File.expand_path("/Users/dscheider/rambo/doc/raml/#{valid_file}"), default_options) Rambo.generate_contract_tests! end end end