Sha256: 761c2ba46bc54ced0259e53168fe3d2aa4ac3bacdba9e7aaa6a2d3bb7bf7a02c

Contents?: true

Size: 1.16 KB

Versions: 12

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

describe "Actions" do

  before do
    integration_test
    @user_group = ensure_save(Rubix::UserGroup.new(:name => 'rubix_spec_user_group_1'))
    @user       = ensure_save(Rubix::User.new(:username => 'rubix_spec_user_1', :first_name => 'rubix', :last_name => 'user', :password => 'pass'))
  end

  after do
    truncate_all_tables
  end

  describe "when not existing" do

    it "returns nil on find" do
      Rubix::Action.find(:name => 'rubix_spec_action_1').should be_nil
    end

    it "can be created" do
      a = Rubix::Action.new(:name => 'rubix_spec_action_1', :operations => [{:user_group => @user_group}])
      a.save.should be_true

      na = Rubix::Action.find(:name => 'rubix_spec_action_1')
      na.should_not be_nil
      na.name.should == 'rubix_spec_action_1'
      na.operations.size.should == 1
    end

  end

  describe "when existing" do
    before do
      @action = ensure_save(Rubix::Action.new(:name => 'rubix_spec_action_1', :operations => [{:user_group => @user_group}]))
    end

    it "can be destroyed" do
      @action.destroy
      Rubix::Action.find(:name => 'rubix_spec_action_1').should be_nil
    end

  end
  
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rubix-0.5.14 spec/requests/action_request_spec.rb
rubix-0.5.13 spec/requests/action_request_spec.rb
rubix-0.5.9 spec/requests/action_request_spec.rb
rubix-0.5.8 spec/requests/action_request_spec.rb
rubix-0.5.7 spec/requests/action_request_spec.rb
rubix-0.5.6 spec/requests/action_request_spec.rb
rubix-0.5.5 spec/requests/action_request_spec.rb
rubix-0.5.4 spec/requests/action_request_spec.rb
rubix-0.5.3 spec/requests/action_request_spec.rb
rubix-0.5.2 spec/requests/action_request_spec.rb
rubix-0.5.1 spec/requests/action_request_spec.rb
rubix-0.5.0 spec/requests/action_request_spec.rb