spec/lib/rambo_spec.rb in rambo_ruby-0.5.0 vs spec/lib/rambo_spec.rb in rambo_ruby-0.6.0
- old
+ new
@@ -1,16 +1,16 @@
RSpec.describe Rambo do
let(:file_contents) do
<<-EOF
raml: doc/raml/foobar.raml
-rails: false
+framework: rails
EOF
end
describe ".generate_contract_tests!" do
let(:valid_file) { "foobar.raml" }
- let(:default_options) { { rails: true } }
+ let(:default_options) { { framework: :rails } }
before(:each) do
allow(Dir).to receive(:foreach).and_return("/Users/dscheider/rambo/doc/raml/#{valid_file}")
end
@@ -37,40 +37,60 @@
end
it "sets the RAML file to the one from the file" do
expect(Rambo::DocumentGenerator)
.to receive(:generate!)
- .with(File.expand_path("doc/raml/foobar.raml"), { rails: false })
+ .with(File.expand_path("doc/raml/foobar.raml"), { framework: :rails })
Rambo.generate_contract_tests!
end
- 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 })
+ context "framework set to sinatra:classic" do
+ it "sets framework to sinatra:classic" do
+ allow(Rambo).to receive(:yaml_options).and_return({ framework: :"sinatra:classic" })
expect(Rambo::DocumentGenerator)
.to receive(:generate!)
- .with("/Users/dscheider/rambo/doc/raml/#{valid_file}", { rails: false })
+ .with("/Users/dscheider/rambo/doc/raml/#{valid_file}", { framework: :"sinatra:classic" })
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 })
+ context "framework set to sinatra:modular" do
+ it "sets framework to sinatra:modular" do
+ allow(Rambo).to receive(:yaml_options).and_return({ framework: :"sinatra:modular" })
expect(Rambo::DocumentGenerator)
.to receive(:generate!)
- .with("/Users/dscheider/rambo/doc/raml/#{valid_file}", { rails: true })
+ .with("/Users/dscheider/rambo/doc/raml/#{valid_file}", { framework: :"sinatra:modular" })
Rambo.generate_contract_tests!
end
end
- context "rails option not set in file" do
- it "sets rails option to true" do
+ context "framework set to Grape" do
+ it "sets framework to Grape" do
+ allow(Rambo).to receive(:yaml_options).and_return({ framework: :grape })
+ expect(Rambo::DocumentGenerator)
+ .to receive(:generate!)
+ .with("/Users/dscheider/rambo/doc/raml/#{valid_file}", { framework: :grape })
+ Rambo.generate_contract_tests!
+ end
+ end
+
+ context "framework set to Rails" do
+ it "sets framework to Rails" do
+ allow(Rambo).to receive(:yaml_options).and_return({ framework: :rails })
+ expect(Rambo::DocumentGenerator)
+ .to receive(:generate!)
+ .with("/Users/dscheider/rambo/doc/raml/#{valid_file}", { framework: :rails })
+ Rambo.generate_contract_tests!
+ end
+ end
+
+ context "framework option not set in file" do
+ it "sets framework to Rails" do
allow(Rambo).to receive(:yaml_options).and_return({})
expect(Rambo::DocumentGenerator)
.to receive(:generate!)
- .with(File.expand_path("/Users/dscheider/rambo/doc/raml/#{valid_file}"), { rails: true })
+ .with(File.expand_path("/Users/dscheider/rambo/doc/raml/#{valid_file}"), { framework: :rails })
Rambo.generate_contract_tests!
end
end
end