Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed log-weasel to log_weasel. First running spec.
- Loading branch information
Showing
11 changed files
with
108 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
rvm --create ruby-1.9.2-p0@log-weasel | ||
rvm --create ruby-1.9.2-p0@log_weasel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in log-weasel.gemspec | ||
# Specify your gem's dependencies in log_weasel.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
require 'bundler' | ||
Bundler.setup | ||
|
||
require 'rspec' | ||
require 'rspec/core/rake_task' | ||
|
||
Bundler::GemHelper.install_tasks | ||
|
||
Rspec::Core::RakeTask.new(:spec) do |spec| | ||
spec.pattern = 'spec/**/*_spec.rb' | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'log_weasel/transaction' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module LogWeasel | ||
module Transaction | ||
|
||
def self.create(key = nil) | ||
Thread.current[:manilla_transaction_id] = "#{key ? "#{key}_" : ""}#{SecureRandom.hex(10)}" | ||
end | ||
|
||
def self.destroy | ||
Thread.current[:manilla_transaction_id] = nil | ||
end | ||
|
||
def self.id=(id) | ||
Thread.current[:manilla_transaction_id] = id | ||
end | ||
|
||
def self.id | ||
Thread.current[:manilla_transaction_id] | ||
end | ||
end | ||
|
||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | ||
require 'active_support' | ||
require 'active_support/secure_random' | ||
|
||
describe LogWeasel::Transaction do | ||
|
||
describe ".id" do | ||
|
||
it "is nil if not created" do | ||
LogWeasel::Transaction.id.should be_nil | ||
end | ||
|
||
end | ||
|
||
describe ".id=" do | ||
before do | ||
LogWeasel::Transaction.id = "1234" | ||
end | ||
|
||
it "sets the id" do | ||
LogWeasel::Transaction.id.should == "1234" | ||
end | ||
|
||
end | ||
|
||
describe ".create" do | ||
before do | ||
SecureRandom.stubs(:hex).returns('94b2') | ||
end | ||
|
||
it 'creates a transaction id with no key' do | ||
id = LogWeasel::Transaction.create | ||
id.should == '94b2' | ||
end | ||
|
||
it 'creates a transaction id with a key' do | ||
id = LogWeasel::Transaction.create 'KEY' | ||
id.should == 'KEY_94b2' | ||
LogWeasel::Transaction.id.should == id | ||
end | ||
|
||
end | ||
|
||
describe ".destroy" do | ||
before do | ||
LogWeasel::Transaction.create | ||
end | ||
|
||
it "removes transaction id" do | ||
LogWeasel::Transaction.destroy | ||
LogWeasel::Transaction.id.should be_nil | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
$LOAD_PATH.unshift(File.dirname(__FILE__)) | ||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) | ||
|
||
require 'log_weasel' | ||
require 'rspec' | ||
|
||
Rspec.configure do |config| | ||
config.mock_with :mocha | ||
end |