Sha256: 61706c0bda56d494d9e16608b4be70368b068f58903fe3f26165f43c33548c1c
Contents?: true
Size: 1.59 KB
Versions: 7
Compression:
Stored size: 1.59 KB
Contents
require 'rails_helper' require "generators/curupira/install/install_generator" describe Curupira::Generators::InstallGenerator, :generator do before do provide_existing_routes_file end describe "feature_model" do context "no existing feature class" do it "generates feature" do run_generator feature_class = file("app/models/feature.rb") expect(feature_class).to exist expect(feature_class).to have_correct_syntax expect(feature_class).to contain("has_many :action_labels") end end context "feature class already exists" do it "includes validations" do provide_existing_class("feature") run_generator feature_class = file("app/models/feature.rb") expect(feature_class).to exist expect(feature_class).to have_correct_syntax expect(feature_class).to contain("has_many :action_labels") end end end describe "feature migration" do context "features table does not exist" do it "creates a migration to create the features table" do allow(ActiveRecord::Base.connection).to receive(:table_exists?).and_return(false) run_generator migration = migration_file("db/migrate/create_features.rb") expect(migration).to exist expect(migration).to have_correct_syntax expect(migration).to contain("create_table :features") expect(migration).to contain("t.string :name") expect(migration).to contain("t.string :controller") expect(migration).to contain("t.boolean :active, default: true") end end end end
Version data entries
7 entries across 7 versions & 1 rubygems